15 Oct, 2014

1 commit


05 Oct, 2014

1 commit


12 Jul, 2014

1 commit

  • This patch introduces a possibility for userspace to set various (so far
    two) modes of generating addresses. This is useful for example for
    NetworkManager because it can set the mode to NONE and take care of link
    local addresses itself. That allow it to have the interface up,
    monitoring carrier but still don't have any addresses on it.

    One more use-case by Dan Williams:

    WWAN devices often have their LL address provided by the firmware of the
    device, which sometimes refuses to respond to incorrect LL addresses
    when doing DHCPv6 or IPv6 ND. The kernel cannot generate the correct LL
    address for two reasons:

    1) WWAN pseudo-ethernet interfaces often construct a fake MAC address,
    or read a meaningless MAC address from the firmware. Thus the EUI64 and
    the IPv6LL address the kernel assigns will be wrong. The real LL
    address is often retrieved from the firmware with AT or proprietary
    commands.

    2) WWAN PPP interfaces receive their LL address from IPV6CP, not from
    kernel assignments. Only after IPV6CP has completed do we know the LL
    address of the PPP interface and its peer. But the kernel has already
    assigned an incorrect LL address to the interface.

    So being able to suppress the kernel LL address generation and assign
    the one retrieved from the firmware is less complicated and more robust.

    Signed-off-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Jiri Pirko
     

29 Mar, 2014

1 commit

  • addrconf_join_solict and addrconf_join_anycast may cause actions which
    need rtnl locked, especially on first address creation.

    A new DAD state is introduced which defers processing of the initial
    DAD processing into a workqueue.

    To get rtnl lock we need to push the code paths which depend on those
    calls up to workqueues, specifically addrconf_verify and the DAD
    processing.

    (v2)
    addrconf_dad_failure needs to be queued up to the workqueue, too. This
    patch introduces a new DAD state and stop the DAD processing in the
    workqueue (this is because of the possible ipv6_del_addr processing
    which removes the solicited multicast address from the device).

    addrconf_verify_lock is removed, too. After the transition it is not
    needed any more.

    As we are not processing in bottom half anymore we need to be a bit more
    careful about disabling bottom half out when we lock spin_locks which are also
    used in bh.

    Relevant backtrace:
    [ 541.030090] RTNL: assertion failed at net/core/dev.c (4496)
    [ 541.031143] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G O 3.10.33-1-amd64-vyatta #1
    [ 541.031145] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2007
    [ 541.031146] ffffffff8148a9f0 000000000000002f ffffffff813c98c1 ffff88007c4451f8
    [ 541.031148] 0000000000000000 0000000000000000 ffffffff813d3540 ffff88007fc03d18
    [ 541.031150] 0000880000000006 ffff88007c445000 ffffffffa0194160 0000000000000000
    [ 541.031152] Call Trace:
    [ 541.031153] [] ? dump_stack+0xd/0x17
    [ 541.031180] [] ? __dev_set_promiscuity+0x101/0x180
    [ 541.031183] [] ? __hw_addr_create_ex+0x60/0xc0
    [ 541.031185] [] ? __dev_set_rx_mode+0xaa/0xc0
    [ 541.031189] [] ? __dev_mc_add+0x61/0x90
    [ 541.031198] [] ? igmp6_group_added+0xfc/0x1a0 [ipv6]
    [ 541.031208] [] ? kmem_cache_alloc+0xcb/0xd0
    [ 541.031212] [] ? ipv6_dev_mc_inc+0x267/0x300 [ipv6]
    [ 541.031216] [] ? addrconf_join_solict+0x2e/0x40 [ipv6]
    [ 541.031219] [] ? ipv6_dev_ac_inc+0x159/0x1f0 [ipv6]
    [ 541.031223] [] ? addrconf_join_anycast+0x92/0xa0 [ipv6]
    [ 541.031226] [] ? __ipv6_ifa_notify+0x11e/0x1e0 [ipv6]
    [ 541.031229] [] ? ipv6_ifa_notify+0x33/0x50 [ipv6]
    [ 541.031233] [] ? addrconf_dad_completed+0x28/0x100 [ipv6]
    [ 541.031241] [] ? task_cputime+0x2d/0x50
    [ 541.031244] [] ? addrconf_dad_timer+0x136/0x150 [ipv6]
    [ 541.031247] [] ? addrconf_dad_completed+0x100/0x100 [ipv6]
    [ 541.031255] [] ? call_timer_fn.isra.22+0x2a/0x90
    [ 541.031258] [] ? addrconf_dad_completed+0x100/0x100 [ipv6]

    Hunks and backtrace stolen from a patch by Stephen Hemminger.

    Reported-by: Stephen Hemminger
    Signed-off-by: Stephen Hemminger
    Signed-off-by: Hannes Frederic Sowa
    Signed-off-by: David S. Miller

    Hannes Frederic Sowa
     

18 Jan, 2014

2 commits

  • Conflicts:
    drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
    net/ipv4/tcp_metrics.c

    Overlapping changes between the "don't create two tcp metrics objects
    with the same key" race fix in net and the addition of the destination
    address in the lookup key in net-next.

    Minor overlapping changes in bnx2x driver.

    Signed-off-by: David S. Miller

    David S. Miller
     
  • In commit 1ec047eb4751e3 ("ipv6: introduce per-interface counter for
    dad-completed ipv6 addresses") I build the detection of the first
    operational link-local address much to complex. Additionally this code
    now has a race condition.

    Replace it with a much simpler variant, which just scans the address
    list when duplicate address detection completes, to check if this is
    the first valid link local address and send RS and MLD reports then.

    Fixes: 1ec047eb4751e3 ("ipv6: introduce per-interface counter for dad-completed ipv6 addresses")
    Reported-by: Jiri Pirko
    Cc: Flavio Leitner
    Signed-off-by: Hannes Frederic Sowa
    Acked-by: Flavio Leitner
    Acked-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Hannes Frederic Sowa
     

07 Dec, 2013

1 commit


29 Oct, 2013

1 commit


05 Sep, 2013

1 commit

  • i) RFC3810, 9.2. Query Interval [QI] says:

    The Query Interval variable denotes the interval between General
    Queries sent by the Querier. Default value: 125 seconds. [...]

    ii) RFC3810, 9.3. Query Response Interval [QRI] says:

    The Maximum Response Delay used to calculate the Maximum Response
    Code inserted into the periodic General Queries. Default value:
    10000 (10 seconds) [...] The number of seconds represented by the
    [Query Response Interval] must be less than the [Query Interval].

    iii) RFC3810, 9.12. Older Version Querier Present Timeout [OVQPT] says:

    The Older Version Querier Present Timeout is the time-out for
    transitioning a host back to MLDv2 Host Compatibility Mode. When an
    MLDv1 query is received, MLDv2 hosts set their Older Version Querier
    Present Timer to [Older Version Querier Present Timeout].

    This value MUST be ([Robustness Variable] times (the [Query Interval]
    in the last Query received)) plus ([Query Response Interval]).

    Hence, on *default* the timeout results in:

    [RV] = 2, [QI] = 125sec, [QRI] = 10sec
    [OVQPT] = [RV] * [QI] + [QRI] = 260sec

    Having that said, we currently calculate [OVQPT] (here given as 'switchback'
    variable) as ...

    switchback = (idev->mc_qrv + 1) * max_delay

    RFC3810, 9.12. says "the [Query Interval] in the last Query received". In
    section "9.14. Configuring timers", it is said:

    This section is meant to provide advice to network administrators on
    how to tune these settings to their network. Ambitious router
    implementations might tune these settings dynamically based upon
    changing characteristics of the network. [...]

    iv) RFC38010, 9.14.2. Query Interval:

    The overall level of periodic MLD traffic is inversely proportional
    to the Query Interval. A longer Query Interval results in a lower
    overall level of MLD traffic. The value of the Query Interval MUST
    be equal to or greater than the Maximum Response Delay used to
    calculate the Maximum Response Code inserted in General Query
    messages.

    I assume that was why switchback is calculated as is (3 * max_delay), although
    this setting seems to be meant for routers only to configure their [QI]
    interval for non-default intervals. So usage here like this is clearly wrong.

    Concluding, the current behaviour in IPv6's multicast code is not conform
    to the RFC as switch back is calculated wrongly. That is, it has a too small
    value, so MLDv2 hosts switch back again to MLDv2 way too early, i.e. ~30secs
    instead of ~260secs on default.

    Hence, introduce necessary helper functions and fix this up properly as it
    should be.

    Introduced in 06da92283 ("[IPV6]: Add MLDv2 support."). Credits to Hannes
    Frederic Sowa who also had a hand in this as well. Also thanks to Hangbin Liu
    who did initial testing.

    Signed-off-by: Daniel Borkmann
    Cc: David Stevens
    Cc: Hannes Frederic Sowa
    Acked-by: Hannes Frederic Sowa
    Signed-off-by: David S. Miller

    Daniel Borkmann
     

29 Jun, 2013

2 commits

  • RFC3590/RFC3810 specifies we should resend MLD reports as soon as a
    valid link-local address is available.

    We now use the valid_ll_addr_cnt to check if it is necessary to resend
    a new report.

    Changes since Flavio Leitner's version:
    a) adapt for valid_ll_addr_cnt
    b) resend first reports directly in the path and just arm the timer for
    mc_qrv-1 resends.

    Reported-by: Flavio Leitner
    Cc: Hideaki YOSHIFUJI
    Cc: David Stevens
    Signed-off-by: Hannes Frederic Sowa
    Signed-off-by: Flavio Leitner
    Signed-off-by: David S. Miller

    Hannes Frederic Sowa
     
  • To reduce the number of unnecessary router solicitations, MLDv2 and IGMPv3
    messages we need to track the number of valid (as in non-optimistic,
    no-dad-failed and non-tentative) link-local addresses. Therefore, this
    patch implements a valid_ll_addr_cnt in struct inet6_dev.

    We now only emit router solicitations if the first link-local address
    finishes duplicate address detection.

    The changes for MLDv2 and IGMPv3 are in a follow-up patch.

    While there, also simplify one if statement(one minor nit I made in one
    of my previous patches):

    if (!...)
    do();
    else
    return;

    <>

    if (...)
    return;
    do();

    Cc: Flavio Leitner
    Cc: YOSHIFUJI Hideaki
    Cc: David Stevens
    Suggested-by: David Stevens
    Signed-off-by: Hannes Frederic Sowa
    Acked-by: Flavio Leitner
    Signed-off-by: David S. Miller

    Hannes Frederic Sowa
     

26 Jun, 2013

1 commit

  • This patch splits the timers for duplicate address detection and router
    solicitations apart. The router solicitations timer goes into inet6_dev
    and the dad timer stays in inet6_ifaddr.

    The reason behind this patch is to reduce the number of unneeded router
    solicitations send out by the host if additional link-local addresses
    are created. Currently we send out RS for every link-local address on
    an interface.

    If the RS timer fires we pick a source address with ipv6_get_lladdr. This
    change could hurt people adding additional link-local addresses and
    specifying these addresses in the radvd clients section because we
    no longer guarantee that we use every ll address as source address in
    router solicitations.

    Cc: Flavio Leitner
    Cc: Hideaki YOSHIFUJI
    Cc: David Stevens
    Signed-off-by: Hannes Frederic Sowa
    Reviewed-by: Flavio Leitner
    Signed-off-by: David S. Miller

    Hannes Frederic Sowa
     

21 May, 2013

1 commit


20 May, 2013

1 commit

  • This patch adds the support of peer address for IPv6. For example, it is
    possible to specify the remote end of a 6inY tunnel.
    This was already possible in IPv4:
    ip addr add ip1 peer ip2 dev dev1

    The peer address is specified with IFA_ADDRESS and the local address with
    IFA_LOCAL (like explained in include/uapi/linux/if_addr.h).
    Note that the API is not changed, because before this patch, it was not
    possible to specify two different addresses in IFA_LOCAL and IFA_REMOTE.
    There is a small change for the dump: if the peer is different from ::,
    IFA_ADDRESS will contain the peer address instead of the local address.

    Signed-off-by: Nicolas Dichtel
    Signed-off-by: David S. Miller

    Nicolas Dichtel
     

10 Apr, 2013

1 commit

  • Instead of invalidating all IPv6 addresses with global scope
    when one decides to use IPv6 tokens, we should only invalidate
    previous tokens and leave the rest intact until they expire
    eventually (or are intact forever). For doing this less greedy
    approach, we're adding a bool at the end of inet6_ifaddr structure
    instead, for two reasons: i) per-inet6_ifaddr flag space is
    already used up, making it wider might not be a good idea,
    since ii) also we do not necessarily need to export this
    information into user space.

    Suggested-by: Hannes Frederic Sowa
    Signed-off-by: Daniel Borkmann
    Signed-off-by: David S. Miller

    Daniel Borkmann
     

09 Apr, 2013

1 commit

  • This patch adds support for IPv6 tokenized IIDs, that allow
    for administrators to assign well-known host-part addresses
    to nodes whilst still obtaining global network prefix from
    Router Advertisements. It is currently in draft status.

    The primary target for such support is server platforms
    where addresses are usually manually configured, rather
    than using DHCPv6 or SLAAC. By using tokenised identifiers,
    hosts can still determine their network prefix by use of
    SLAAC, but more readily be automatically renumbered should
    their network prefix change. [...]

    The disadvantage with static addresses is that they are
    likely to require manual editing should the network prefix
    in use change. If instead there were a method to only
    manually configure the static identifier part of the IPv6
    address, then the address could be automatically updated
    when a new prefix was introduced, as described in [RFC4192]
    for example. In such cases a DNS server might be
    configured with such a tokenised interface identifier of
    ::53, and SLAAC would use the token in constructing the
    interface address, using the advertised prefix. [...]

    http://tools.ietf.org/html/draft-chown-6man-tokenised-ipv6-identifiers-02

    The implementation is partially based on top of Mark K.
    Thompson's proof of concept. However, it uses the Netlink
    interface for configuration resp. data retrival, so that
    it can be easily extended in future. Successfully tested
    by myself.

    Cc: Hannes Frederic Sowa
    Cc: YOSHIFUJI Hideaki
    Cc: Thomas Graf
    Signed-off-by: Daniel Borkmann
    Signed-off-by: David S. Miller

    Daniel Borkmann
     

16 May, 2012

1 commit

  • We are going to delete the Token ring support. This removes any
    special processing in the core networking for token ring, (aside
    from net/tr.c itself), leaving the drivers and remaining tokenring
    support present but inert.

    The mass removal of the drivers and net/tr.c will be in a separate
    commit, so that the history of these files that we still care
    about won't have the giant deletion tied into their history.

    Signed-off-by: Paul Gortmaker

    Paul Gortmaker
     

16 Apr, 2012

1 commit


02 Aug, 2011

1 commit

  • Update the code to handle some of the differences between
    RFC 3041 and RFC 4941, which obsoletes it. Also a couple
    of janitorial fixes.

    - Allow router advertisements to increase the lifetime of
    temporary addresses. This was not allowed by RFC 3041,
    but is specified by RFC 4941. It is useful when RA
    lifetimes are lower than TEMP_{VALID,PREFERRED}_LIFETIME:
    in this case, the previous code would delete or deprecate
    addresses prematurely.

    - Change the default of MAX_RETRY to 3 per RFC 4941.

    - Add a comment to clarify that the preferred and valid
    lifetimes in inet6_ifaddr are relative to the timestamp.

    - Shorten lines to 80 characters in a couple of places.

    Signed-off-by: Lorenzo Colitti
    Signed-off-by: David S. Miller

    Lorenzo Colitti
     

20 May, 2011

1 commit

  • ipv6 has per device ICMP SNMP counters, taking too much space because
    they use percpu storage.

    needed size per device is :
    (512+4)*sizeof(long)*number_of_possible_cpus*2

    On a 32bit kernel, 16 possible cpus, this wastes more than 64kbytes of
    memory per ipv6 enabled network device, taken in vmalloc pool.

    Since ICMP messages are rare, just use shared counters (atomic_long_t)

    Per network space ICMP counters are still using percpu memory, we might
    also convert them to shared counters in a future patch.

    Signed-off-by: Eric Dumazet
    CC: Denys Fedoryshchenko
    Signed-off-by: David S. Miller

    Eric Dumazet
     

25 Apr, 2011

1 commit

  • These header files are never installed to user consumption, so any
    __KERNEL__ cpp checks are superfluous.

    Projects should also not copy these files into their userland utility
    sources and try to use them there. If they insist on doing so, the
    onus is on them to sanitize the headers as needed.

    Signed-off-by: David S. Miller

    David S. Miller
     

23 Apr, 2011

1 commit


30 Mar, 2011

1 commit

  • My commit 6d55cb91a0020ac0 (gre: fix hard header destination
    address checking) broke multicast.

    The reason is that ip_gre used to get ipgre_header() calls with
    zero destination if we have NOARP or multicast destination. Instead
    the actual target was decided at ipgre_tunnel_xmit() time based on
    per-protocol dissection.

    Instead of allowing the "abuse" of ->header() calls with invalid
    destination, this creates multicast mappings for ip_gre. This also
    fixes "ip neigh show nud noarp" to display the proper multicast
    mappings used by the gre device.

    Reported-by: Doug Kehn
    Signed-off-by: Timo Teräs
    Acked-by: Doug Kehn
    Signed-off-by: David S. Miller

    Timo Teräs
     

25 Nov, 2010

1 commit

  • ipv6_sk_mc_lock rwlock becomes a spinlock.

    readers (inet6_mc_check()) now takes rcu_read_lock() instead of read
    lock. Writers dont need to disable BH anymore.

    struct ipv6_mc_socklist objects are reclaimed after one RCU grace
    period.

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

19 May, 2010

1 commit

  • This patch replaces the boolean dead flag on inet6_ifaddr with
    a state enum. This allows us to roll back changes when deleting
    an address according to whether DAD has completed or not.

    This patch only adds the state field and does not change the logic.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     

21 Mar, 2010

4 commits


18 Feb, 2010

1 commit


04 Nov, 2009

1 commit

  • This cleanup patch puts struct/union/enum opening braces,
    in first line to ease grep games.

    struct something
    {

    becomes :

    struct something {

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

22 Mar, 2009

1 commit


23 Jul, 2008

1 commit


12 Jun, 2008

1 commit


03 Feb, 2008

2 commits

  • /home/acme/git/net-2.6/net/ipv6/mcast.c:
    struct ifmcaddr6 | -8
    1 struct changed
    igmp6_group_dropped | -6
    add_grec | -3
    mld_ifc_timer_expire | -18
    ip6_mc_add_src | -3
    ip6_mc_del_src | -3
    igmp6_group_added | -3
    6 functions changed, 36 bytes removed, diff: -36

    ipv6.ko:
    6 functions changed, 36 bytes removed, diff: -36

    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: David S. Miller

    Arnaldo Carvalho de Melo
     
  • And make it a multiple of a 64 bytes, reducing cacheline trashing:

    Before:

    [acme@doppio net-2.6]$ pahole -C inet6_dev net/dccp/ipv6.o
    struct inet6_dev {

    long unsigned int mc_maxdelay; /* 48 8 */
    unsigned char mc_qrv; /* 56 1 */
    unsigned char mc_gq_running; /* 57 1 */
    unsigned char mc_ifc_count; /* 58 1 */

    /* XXX 5 bytes hole, try to pack */

    /* --- cacheline 1 boundary (64 bytes) --- */
    struct timer_list mc_gq_timer; /* 64 48 */

    __u32 if_flags; /* 180 4 */
    int dead; /* 184 4 */
    u8 rndid[8]; /* 188 8 */

    /* XXX 4 bytes hole, try to pack */

    /* --- cacheline 3 boundary (192 bytes) was 8 bytes ago --- */
    struct timer_list regen_timer; /* 200 48 */

    /* size: 456, cachelines: 8 */
    /* sum members: 447, holes: 2, sum holes: 9 */
    /* last cacheline: 8 bytes */
    };

    After:

    net-2.6/net/ipv6/af_inet6.c:
    struct inet6_dev | -8
    1 struct changed

    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: David S. Miller

    Arnaldo Carvalho de Melo
     

26 Jan, 2008

1 commit

  • An IPoIB subnet on an IB fabric that spans multiple IB subnets can't
    use link-local scope in multicast GIDs. The existing routines that
    map IP/IPv6 multicast addresses into IB link-level addresses hard-code
    the scope to link-local, and they also leave the partition key field
    uninitialised. This patch adds a parameter (the link-level broadcast
    address) to the mapping routines, allowing them to initialise both the
    scope and the P_Key appropriately, and fixes up the call sites.

    The next step will be to add a way to configure the scope for an IPoIB
    interface.

    Signed-off-by: Rolf Manderscheid
    Signed-off-by: Roland Dreier

    Rolf Manderscheid
     

11 Oct, 2007

1 commit

  • Background: RFC 4293 deprecates existing individual, named ICMP
    type counters to be replaced with the ICMPMsgStatsTable. This table
    includes entries for both IPv4 and IPv6, and requires counting of all
    ICMP types, whether or not the machine implements the type.

    These patches "remove" (but not really) the existing counters, and
    replace them with the ICMPMsgStats tables for v4 and v6.
    It includes the named counters in the /proc places they were, but gets the
    values for them from the new tables. It also counts packets generated
    from raw socket output (e.g., OutEchoes, MLD queries, RA's from
    radvd, etc).

    Changes:
    1) create icmpmsg_statistics mib
    2) create icmpv6msg_statistics mib
    3) modify existing counters to use these
    4) modify /proc/net/snmp to add "IcmpMsg" with all ICMP types
    listed by number for easy SNMP parsing
    5) modify /proc/net/snmp printing for "Icmp" to get the named data
    from new counters.
    [new to 2nd revision]
    6) support per-interface ICMP stats
    7) use common macro for per-device stat macros

    Signed-off-by: David L Stevens
    Signed-off-by: David S. Miller

    David L Stevens
     

03 Dec, 2006

1 commit


23 Sep, 2006

1 commit