04 Dec, 2016

1 commit

  • Implemented RFC7527 Enhanced DAD.
    IPv6 duplicate address detection can fail if there is some temporary
    loopback of Ethernet frames. RFC7527 solves this by including a random
    nonce in the NS messages used for DAD, and if an NS is received with the
    same nonce it is assumed to be a looped back DAD probe and is ignored.
    RFC7527 is enabled by default. Can be disabled by setting both of
    conf/{all,interface}/enhanced_dad to zero.

    Signed-off-by: Erik Nordmark
    Signed-off-by: Bob Gilligan
    Reviewed-by: Hannes Frederic Sowa
    Signed-off-by: David S. Miller

    Erik Nordmark
     

11 Sep, 2016

1 commit


16 Jun, 2016

3 commits

  • This patch exports some neighbour discovery functions which can be used
    by 6lowpan neighbour discovery ops functionality then.

    Cc: David S. Miller
    Cc: Alexey Kuznetsov
    Cc: James Morris
    Cc: Hideaki YOSHIFUJI
    Cc: Patrick McHardy
    Acked-by: YOSHIFUJI Hideaki
    Reviewed-by: Stefan Schmidt
    Signed-off-by: Alexander Aring
    Signed-off-by: David S. Miller

    Alexander Aring
     
  • This patch introduces neighbour discovery ops callback structure. The
    idea is to separate the handling for 6LoWPAN into the 6lowpan module.

    These callback offers 6lowpan different handling, such as 802.15.4 short
    address handling or RFC6775 (Neighbor Discovery Optimization for IPv6
    over 6LoWPANs).

    Cc: David S. Miller
    Cc: Alexey Kuznetsov
    Cc: James Morris
    Cc: Hideaki YOSHIFUJI
    Cc: Patrick McHardy
    Acked-by: YOSHIFUJI Hideaki
    Signed-off-by: Alexander Aring
    Signed-off-by: David S. Miller

    Alexander Aring
     
  • This patch adds __ndisc_fill_addr_option as low-level function for
    ndisc_fill_addr_option which doesn't depend on net_device parameter.

    Cc: David S. Miller
    Cc: Alexey Kuznetsov
    Cc: James Morris
    Cc: Hideaki YOSHIFUJI
    Cc: Patrick McHardy
    Acked-by: YOSHIFUJI Hideaki
    Reviewed-by: Stefan Schmidt
    Signed-off-by: Alexander Aring
    Signed-off-by: David S. Miller

    Alexander Aring
     

11 Feb, 2016

1 commit

  • In certain 802.11 wireless deployments, there will be NA proxies
    that use knowledge of the network to correctly answer requests.
    To prevent unsolicitd advertisements on the shared medium from
    being a problem, on such deployments wireless needs to drop them.

    Enable this by providing an option called "drop_unsolicited_na".

    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     

24 Dec, 2015

1 commit

  • Marc Haber reported we don't honor interface indexes when we receive link
    local router addresses in router advertisements. Luckily the non-strict
    version of ipv6_chk_addr already does the correct job here, so we can
    simply use it to lighten the checks and use those addresses by default
    without any configuration change.

    Link:
    Reported-by: Marc Haber
    Cc: Marc Haber
    Signed-off-by: Hannes Frederic Sowa
    Signed-off-by: David S. Miller

    Hannes Frederic Sowa
     

02 Dec, 2015

1 commit

  • This reverts commit ab450605b35caa768ca33e86db9403229bf42be4.

    In IPv6, we cannot inherit the dst of the original dst. ndisc packets
    are IPv6 packets and may take another route than the original packet.

    This patch breaks the following scenario: a packet comes from eth0 and
    is forwarded through vxlan1. The encapsulated packet triggers an NS
    which cannot be sent because of the wrong route.

    CC: Jiri Benc
    CC: Thomas Graf
    Signed-off-by: Nicolas Dichtel
    Signed-off-by: David S. Miller

    Nicolas Dichtel
     

13 Oct, 2015

2 commits


08 Oct, 2015

1 commit


25 Sep, 2015

1 commit


18 Sep, 2015

3 commits

  • This is immediately motivated by the bridge code that chains functions that
    call into netfilter. Without passing net into the okfns the bridge code would
    need to guess about the best expression for the network namespace to process
    packets in.

    As net is frequently one of the first things computed in continuation functions
    after netfilter has done it's job passing in the desired network namespace is in
    many cases a code simplification.

    To support this change the function dst_output_okfn is introduced to
    simplify passing dst_output as an okfn. For the moment dst_output_okfn
    just silently drops the struct net.

    Signed-off-by: "Eric W. Biederman"
    Signed-off-by: David S. Miller

    Eric W. Biederman
     
  • Pass a network namespace parameter into the netfilter hooks. At the
    call site of the netfilter hooks the path a packet is taking through
    the network stack is well known which allows the network namespace to
    be easily and reliabily.

    This allows the replacement of magic code like
    "dev_net(state->in?:state->out)" that appears at the start of most
    netfilter hooks with "state->net".

    In almost all cases the network namespace passed in is derived
    from the first network device passed in, guaranteeing those
    paths will not see any changes in practice.

    The exceptions are:
    xfrm/xfrm_output.c:xfrm_output_resume() xs_net(skb_dst(skb)->xfrm)
    ipvs/ip_vs_xmit.c:ip_vs_nat_send_or_cont() ip_vs_conn_net(cp)
    ipvs/ip_vs_xmit.c:ip_vs_send_or_cont() ip_vs_conn_net(cp)
    ipv4/raw.c:raw_send_hdrinc() sock_net(sk)
    ipv6/ip6_output.c:ip6_xmit() sock_net(sk)
    ipv6/ndisc.c:ndisc_send_skb() dev_net(skb->dev) not dev_net(dst->dev)
    ipv6/raw.c:raw6_send_hdrinc() sock_net(sk)
    br_netfilter_hooks.c:br_nf_pre_routing_finish() dev_net(skb->dev) before skb->dev is set to nf_bridge->physindev

    In all cases these exceptions seem to be a better expression for the
    network namespace the packet is being processed in then the historic
    "dev_net(in?in:out)". I am documenting them in case something odd
    pops up and someone starts trying to track down what happened.

    Signed-off-by: "Eric W. Biederman"
    Signed-off-by: David S. Miller

    Eric W. Biederman
     
  • Add a sock paramter to dst_output making dst_output_sk superfluous.
    Add a skb->sk parameter to all of the callers of dst_output
    Have the callers of dst_output_sk call dst_output.

    Signed-off-by: "Eric W. Biederman"
    Signed-off-by: David S. Miller

    Eric W. Biederman
     

01 Sep, 2015

2 commits


21 Aug, 2015

1 commit


01 Aug, 2015

1 commit


31 Jul, 2015

1 commit

  • Commit 6fd99094de2b ("ipv6: Don't reduce hop limit for an interface")
    disabled accept hop limit from RA if it is smaller than the current hop
    limit for security stuff. But this behavior kind of break the RFC definition.

    RFC 4861, 6.3.4. Processing Received Router Advertisements
    A Router Advertisement field (e.g., Cur Hop Limit, Reachable Time,
    and Retrans Timer) may contain a value denoting that it is
    unspecified. In such cases, the parameter should be ignored and the
    host should continue using whatever value it is already using.

    If the received Cur Hop Limit value is non-zero, the host SHOULD set
    its CurHopLimit variable to the received value.

    So add sysctl option accept_ra_min_hop_limit to let user choose the minimum
    hop limit value they can accept from RA. And set default to 1 to meet RFC
    standards.

    Signed-off-by: Hangbin Liu
    Acked-by: YOSHIFUJI Hideaki
    Signed-off-by: David S. Miller

    Hangbin Liu
     

30 Jul, 2015

1 commit

  • This patch is the IPv6 equivalent of commit
    6c8b4e3ff81b ("arp: flush arp cache on IFF_NOARP change")

    Without it, we keep buggy neighbours in the cache, with destination
    MAC address equal to our own MAC address.

    Tested:
    tcpdump -i eth0 -s 0 ip6 -n -e &
    ip link set dev eth0 arp off
    ping6 remote // sends buggy frames
    ip link set dev eth0 arp on
    ping6 remote // should work once kernel is patched

    Signed-off-by: Eric Dumazet
    Reported-by: Mario Fanelli
    Signed-off-by: David S. Miller

    Eric Dumazet
     

26 May, 2015

1 commit

  • This patch removes the assumptions that the returned rt is always
    a RTF_CACHE entry with the rt6i_dst and rt6i_src containing the
    destination and source address. The dst and src can be recovered from
    the calling site.

    We may consider to rename (rt6i_dst, rt6i_src) to
    (rt6i_key_dst, rt6i_key_src) later.

    Signed-off-by: Martin KaFai Lau
    Reviewed-by: Hannes Frederic Sowa
    Cc: Steffen Klassert
    Cc: Julian Anastasov
    Signed-off-by: David S. Miller

    Martin KaFai Lau
     

08 Apr, 2015

1 commit

  • On the output paths in particular, we have to sometimes deal with two
    socket contexts. First, and usually skb->sk, is the local socket that
    generated the frame.

    And second, is potentially the socket used to control a tunneling
    socket, such as one the encapsulates using UDP.

    We do not want to disassociate skb->sk when encapsulating in order
    to fix this, because that would break socket memory accounting.

    The most extreme case where this can cause huge problems is an
    AF_PACKET socket transmitting over a vxlan device. We hit code
    paths doing checks that assume they are dealing with an ipv4
    socket, but are actually operating upon the AF_PACKET one.

    Signed-off-by: David S. Miller

    David Miller
     

03 Apr, 2015

1 commit

  • Conflicts:
    drivers/net/usb/asix_common.c
    drivers/net/usb/sr9800.c
    drivers/net/usb/usbnet.c
    include/linux/usb/usbnet.h
    net/ipv4/tcp_ipv4.c
    net/ipv6/tcp_ipv6.c

    The TCP conflicts were overlapping changes. In 'net' we added a
    READ_ONCE() to the socket cached RX route read, whilst in 'net-next'
    Eric Dumazet touched the surrounding code dealing with how mini
    sockets are handled.

    With USB, it's a case of the same bug fix first going into net-next
    and then I cherry picked it back into net.

    Signed-off-by: David S. Miller

    David S. Miller
     

01 Apr, 2015

2 commits

  • IP addresses are often stored in netlink attributes. Add generic functions
    to do that.

    For nla_put_in_addr, it would be nicer to pass struct in_addr but this is
    not used universally throughout the kernel, in way too many places __be32 is
    used to store IPv4 address.

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

    Jiri Benc
     
  • The ipv6 code uses a mixture of coding styles. In some instances check for NULL
    pointer is done as x == NULL and sometimes as !x. !x is preferred according to
    checkpatch and this patch makes the code consistent by adopting the latter
    form.

    No changes detected by objdiff.

    Signed-off-by: Ian Morris
    Signed-off-by: David S. Miller

    Ian Morris
     

25 Mar, 2015

1 commit

  • A local route may have a lower hop_limit set than global routes do.

    RFC 3756, Section 4.2.7, "Parameter Spoofing"

    > 1. The attacker includes a Current Hop Limit of one or another small
    > number which the attacker knows will cause legitimate packets to
    > be dropped before they reach their destination.

    > As an example, one possible approach to mitigate this threat is to
    > ignore very small hop limits. The nodes could implement a
    > configurable minimum hop limit, and ignore attempts to set it below
    > said limit.

    Signed-off-by: D.S. Ljungmark
    Acked-by: Hannes Frederic Sowa
    Signed-off-by: David S. Miller

    D.S. Ljungmark
     

04 Mar, 2015

1 commit

  • While looking at the mpls code I found myself writing yet another
    version of neigh_lookup_noref. We currently have __ipv4_lookup_noref
    and __ipv6_lookup_noref.

    So to make my work a little easier and to make it a smidge easier to
    verify/maintain the mpls code in the future I stopped and wrote
    ___neigh_lookup_noref. Then I rewote __ipv4_lookup_noref and
    __ipv6_lookup_noref in terms of this new function. I tested my new
    version by verifying that the same code is generated in
    ip_finish_output2 and ip6_finish_output2 where these functions are
    inlined.

    To get to ___neigh_lookup_noref I added a new neighbour cache table
    function key_eq. So that the static size of the key would be
    available.

    I also added __neigh_lookup_noref for people who want to to lookup
    a neighbour table entry quickly but don't know which neibhgour table
    they are going to look up.

    Signed-off-by: "Eric W. Biederman"
    Signed-off-by: David S. Miller

    Eric W. Biederman
     

03 Mar, 2015

1 commit

  • - Add protocol to neigh_tbl so that dst->ops->protocol is not needed
    - Acquire the device from neigh->dev

    This results in a neigh_hh_init that will cache the samve values
    regardless of the packets flowing through it.

    Signed-off-by: "Eric W. Biederman"
    Signed-off-by: David S. Miller

    Eric W. Biederman
     

10 Feb, 2015

1 commit


06 Feb, 2015

1 commit

  • RFC 4429 ("Optimistic DAD") states that optimistic addresses
    should be treated as deprecated addresses. From section 2.1:

    Unless noted otherwise, components of the IPv6 protocol stack
    should treat addresses in the Optimistic state equivalently to
    those in the Deprecated state, indicating that the address is
    available for use but should not be used if another suitable
    address is available.

    Optimistic addresses are indeed avoided when other addresses are
    available (i.e. at source address selection time), but they have
    not heretofore been available for things like explicit bind() and
    sendmsg() with struct in6_pktinfo, etc.

    This change makes optimistic addresses treated more like
    deprecated addresses than tentative ones.

    Signed-off-by: Erik Kline
    Acked-by: Lorenzo Colitti
    Acked-by: Hannes Frederic Sowa
    Signed-off-by: David S. Miller

    Erik Kline
     

26 Jan, 2015

1 commit

  • The kernel forcefully applies MTU values received in router
    advertisements provided the new MTU is less than the current. This
    behavior is undesirable when the user space is managing the MTU. Instead
    a sysctl flag 'accept_ra_mtu' is introduced such that the user space
    can control whether or not RA provided MTU updates should be applied. The
    default behavior is unchanged; user space must explicitly set this flag
    to 0 for RA MTUs to be ignored.

    Signed-off-by: Harout Hedeshian
    Signed-off-by: David S. Miller

    Harout Hedeshian
     

24 Nov, 2014

1 commit


12 Nov, 2014

1 commit

  • Currently there are only three neigh tables in the whole kernel:
    arp table, ndisc table and decnet neigh table. What's more,
    we don't support registering multiple tables per family.
    Therefore we can just make these tables statically built-in.

    Cc: David S. Miller
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    WANG Cong
     

25 Aug, 2014

2 commits

  • This patch makes no changes to the logic of the code but simply addresses
    coding style issues as detected by checkpatch.

    Both objdump and diff -w show no differences.

    This patch removes some blank lines between the end of a function
    definition and the EXPORT_SYMBOL_GPL macro in order to prevent
    checkpatch warning that EXPORT_SYMBOL must immediately follow
    a function.

    Signed-off-by: Ian Morris
    Signed-off-by: David S. Miller

    Ian Morris
     
  • This patch makes no changes to the logic of the code but simply addresses
    coding style issues as detected by checkpatch.

    Both objdump and diff -w show no differences.

    A number of items are addressed in this patch:
    * Multiple spaces converted to tabs
    * Spaces before tabs removed.
    * Spaces in pointer typing cleansed (char *)foo etc.
    * Remove space after sizeof
    * Ensure spacing around comparators such as if statements.

    Signed-off-by: Ian Morris
    Signed-off-by: David S. Miller

    Ian Morris
     

25 Jul, 2014

1 commit

  • In this file, function names are otherwise used as pointers without &.

    A simplified version of the Coccinelle semantic patch that makes this
    change is as follows:

    //
    @r@
    identifier f;
    @@

    f(...) { ... }

    @@
    identifier r.f;
    @@

    - &f
    + f
    //

    Signed-off-by: Himangi Saraogi
    Acked-by: Julia Lawall
    Signed-off-by: David S. Miller

    Himangi Saraogi
     

11 Jul, 2014

1 commit

  • d9333196572(ipv6: Allow accepting RA from local IP addresses.) made the wrong
    check, whether or not to accept RA with source-addr found on local machine, when
    accept_ra_from_local is 0.

    Fixes: d9333196572(ipv6: Allow accepting RA from local IP addresses.)
    Cc: Ben Greear
    Cc: Hannes Frederic Sowa
    Signed-off-by: Li RongQing
    Acked-by: Hannes Frederic Sowa
    Signed-off-by: David S. Miller

    Li RongQing
     

02 Jul, 2014

2 commits

  • This can be used in virtual networking applications, and
    may have other uses as well. The option is disabled by
    default.

    A specific use case is setting up virtual routers, bridges, and
    hosts on a single OS without the use of network namespaces or
    virtual machines. With proper use of ip rules, routing tables,
    veth interface pairs and/or other virtual interfaces,
    and applications that can bind to interfaces and/or IP addresses,
    it is possibly to create one or more virtual routers with multiple
    hosts attached. The host interfaces can act as IPv6 systems,
    with radvd running on the ports in the virtual routers. With the
    option provided in this patch enabled, those hosts can now properly
    obtain IPv6 addresses from the radvd.

    Signed-off-by: Ben Greear
    Signed-off-by: David S. Miller

    Ben Greear
     
  • This is disabled by default, just like similar debug info
    already in this module. But, makes it easier to find out
    why RA is not being accepted when debugging strange behaviour.

    Signed-off-by: Ben Greear
    Signed-off-by: David S. Miller

    Ben Greear