1. 11 8月, 2016 1 次提交
  2. 09 8月, 2016 1 次提交
  3. 31 7月, 2016 1 次提交
  4. 27 7月, 2016 1 次提交
  5. 26 7月, 2016 2 次提交
  6. 19 7月, 2016 1 次提交
    • F
      netfilter: x_tables: speed up jump target validation · f4dc7771
      Florian Westphal 提交于
      The dummy ruleset I used to test the original validation change was broken,
      most rules were unreachable and were not tested by mark_source_chains().
      
      In some cases rulesets that used to load in a few seconds now require
      several minutes.
      
      sample ruleset that shows the behaviour:
      
      echo "*filter"
      for i in $(seq 0 100000);do
              printf ":chain_%06x - [0:0]\n" $i
      done
      for i in $(seq 0 100000);do
         printf -- "-A INPUT -j chain_%06x\n" $i
         printf -- "-A INPUT -j chain_%06x\n" $i
         printf -- "-A INPUT -j chain_%06x\n" $i
      done
      echo COMMIT
      
      [ pipe result into iptables-restore ]
      
      This ruleset will be about 74mbyte in size, with ~500k searches
      though all 500k[1] rule entries. iptables-restore will take forever
      (gave up after 10 minutes)
      
      Instead of always searching the entire blob for a match, fill an
      array with the start offsets of every single ipt_entry struct,
      then do a binary search to check if the jump target is present or not.
      
      After this change ruleset restore times get again close to what one
      gets when reverting 36472341 (~3 seconds on my workstation).
      
      [1] every user-defined rule gets an implicit RETURN, so we get
      300k jumps + 100k userchains + 100k returns -> 500k rule entries
      
      Fixes: 36472341 ("netfilter: x_tables: validate targets of jumps")
      Reported-by: NJeff Wu <wujiafu@gmail.com>
      Tested-by: NJeff Wu <wujiafu@gmail.com>
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      f4dc7771
  7. 17 7月, 2016 1 次提交
    • N
      net: ipmr/ip6mr: add support for keeping an entry age · 43b9e127
      Nikolay Aleksandrov 提交于
      In preparation for hardware offloading of ipmr/ip6mr we need an
      interface that allows to check (and later update) the age of entries.
      Relying on stats alone can show activity but not actual age of the entry,
      furthermore when there're tens of thousands of entries a lot of the
      hardware implementations only support "hit" bits which are cleared on
      read to denote that the entry was active and shouldn't be aged out,
      these can then be naturally translated into age timestamp and will be
      compatible with the software forwarding age. Using a lastuse entry doesn't
      affect performance because the members in that cache line are written to
      along with the age.
      Since all new users are encouraged to use ipmr via netlink, this is
      exported via the RTA_EXPIRES attribute.
      Also do a minor local variable declaration style adjustment - arrange them
      longest to shortest.
      Signed-off-by: NNikolay Aleksandrov <nikolay@cumulusnetworks.com>
      CC: Roopa Prabhu <roopa@cumulusnetworks.com>
      CC: Shrijeet Mukherjee <shm@cumulusnetworks.com>
      CC: Satish Ashok <sashok@cumulusnetworks.com>
      CC: Donald Sharp <sharpd@cumulusnetworks.com>
      CC: David S. Miller <davem@davemloft.net>
      CC: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
      CC: James Morris <jmorris@namei.org>
      CC: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
      CC: Patrick McHardy <kaber@trash.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      43b9e127
  8. 12 7月, 2016 1 次提交
  9. 10 7月, 2016 2 次提交
  10. 06 7月, 2016 1 次提交
  11. 03 7月, 2016 1 次提交
    • J
      netfilter: Convert FWINV<[foo]> macros and uses to NF_INVF · c37a2dfa
      Joe Perches 提交于
      netfilter uses multiple FWINV #defines with identical form that hide a
      specific structure variable and dereference it with a invflags member.
      
      $ git grep "#define FWINV"
      include/linux/netfilter_bridge/ebtables.h:#define FWINV(bool,invflg) ((bool) ^ !!(info->invflags & invflg))
      net/bridge/netfilter/ebtables.c:#define FWINV2(bool, invflg) ((bool) ^ !!(e->invflags & invflg))
      net/ipv4/netfilter/arp_tables.c:#define FWINV(bool, invflg) ((bool) ^ !!(arpinfo->invflags & (invflg)))
      net/ipv4/netfilter/ip_tables.c:#define FWINV(bool, invflg) ((bool) ^ !!(ipinfo->invflags & (invflg)))
      net/ipv6/netfilter/ip6_tables.c:#define FWINV(bool, invflg) ((bool) ^ !!(ip6info->invflags & (invflg)))
      net/netfilter/xt_tcpudp.c:#define FWINVTCP(bool, invflg) ((bool) ^ !!(tcpinfo->invflags & (invflg)))
      
      Consolidate these macros into a single NF_INVF macro.
      
      Miscellanea:
      
      o Neaten the alignment around these uses
      o A few lines are > 80 columns for intelligibility
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      c37a2dfa
  12. 01 7月, 2016 2 次提交
  13. 28 6月, 2016 13 次提交
  14. 27 6月, 2016 1 次提交
    • P
      ipv6: enforce egress device match in per table nexthop lookups · 48f1dcb5
      Paolo Abeni 提交于
      with the commit 8c14586f ("net: ipv6: Use passed in table for
      nexthop lookups"), net hop lookup is first performed on route creation
      in the passed-in table.
      However device match is not enforced in table lookup, so the found
      route can be later discarded due to egress device mismatch and no
      global lookup will be performed.
      This cause the following to fail:
      
      ip link add dummy1 type dummy
      ip link add dummy2 type dummy
      ip link set dummy1 up
      ip link set dummy2 up
      ip route add 2001:db8:8086::/48 dev dummy1 metric 20
      ip route add 2001:db8:d34d::/64 via 2001:db8:8086::2 dev dummy1 metric 20
      ip route add 2001:db8:8086::/48 dev dummy2 metric 21
      ip route add 2001:db8:d34d::/64 via 2001:db8:8086::2 dev dummy2 metric 21
      RTNETLINK answers: No route to host
      
      This change fixes the issue enforcing device lookup in
      ip6_nh_lookup_table()
      
      v1->v2: updated commit message title
      
      Fixes: 8c14586f ("net: ipv6: Use passed in table for nexthop lookups")
      Reported-and-tested-by: NBeniamino Galvani <bgalvani@redhat.com>
      Signed-off-by: NPaolo Abeni <pabeni@redhat.com>
      Acked-by: NDavid Ahern <dsa@cumulusnetworks.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      48f1dcb5
  15. 19 6月, 2016 4 次提交
  16. 18 6月, 2016 3 次提交
  17. 17 6月, 2016 2 次提交
    • A
      net: xfrm: fix old-style declaration · 318d3cc0
      Arnd Bergmann 提交于
      Modern C standards expect the '__inline__' keyword to come before the return
      type in a declaration, and we get a couple of warnings for this with "make W=1"
      in the xfrm{4,6}_policy.c files:
      
      net/ipv6/xfrm6_policy.c:369:1: error: 'inline' is not at beginning of declaration [-Werror=old-style-declaration]
       static int inline xfrm6_net_sysctl_init(struct net *net)
      net/ipv6/xfrm6_policy.c:374:1: error: 'inline' is not at beginning of declaration [-Werror=old-style-declaration]
       static void inline xfrm6_net_sysctl_exit(struct net *net)
      net/ipv4/xfrm4_policy.c:339:1: error: 'inline' is not at beginning of declaration [-Werror=old-style-declaration]
       static int inline xfrm4_net_sysctl_init(struct net *net)
      net/ipv4/xfrm4_policy.c:344:1: error: 'inline' is not at beginning of declaration [-Werror=old-style-declaration]
       static void inline xfrm4_net_sysctl_exit(struct net *net)
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      318d3cc0
    • S
      sit: correct IP protocol used in ipip6_err · d5d8760b
      Simon Horman 提交于
      Since 32b8a8e5 ("sit: add IPv4 over IPv4 support")
      ipip6_err() may be called for packets whose IP protocol is
      IPPROTO_IPIP as well as those whose IP protocol is IPPROTO_IPV6.
      
      In the case of IPPROTO_IPIP packets the correct protocol value is not
      passed to ipv4_update_pmtu() or ipv4_redirect().
      
      This patch resolves this problem by using the IP protocol of the packet
      rather than a hard-coded value. This appears to be consistent
      with the usage of the protocol of a packet by icmp_socket_deliver()
      the caller of ipip6_err().
      
      I was able to exercise the redirect case by using a setup where an ICMP
      redirect was received for the destination of the encapsulated packet.
      However, it appears that although incorrect the protocol field is not used
      in this case and thus no problem manifests.  On inspection it does not
      appear that a problem will manifest in the fragmentation needed/update pmtu
      case either.
      
      In short I believe this is a cosmetic fix. None the less, the use of
      IPPROTO_IPV6 seems wrong and confusing.
      Reviewed-by: NDinan Gunawardena <dinan.gunawardena@netronome.com>
      Signed-off-by: NSimon Horman <simon.horman@netronome.com>
      Acked-by: NYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d5d8760b
  18. 16 6月, 2016 2 次提交
    • E
      gre: fix error handler · e582615a
      Eric Dumazet 提交于
      1) gre_parse_header() can be called from gre_err()
      
         At this point transport header points to ICMP header, not the inner
      header.
      
      2) We can not really change transport header as ipgre_err() will later
      assume transport header still points to ICMP header (using icmp_hdr())
      
      3) pskb_may_pull() logic in gre_parse_header() really works
        if we are interested at zone pointed by skb->data
      
      4) As Jiri explained in commit b7f8fe25 ("gre: do not pull header in
      ICMP error processing") we should not pull headers in error handler.
      
      So this fix :
      
      A) changes gre_parse_header() to use skb->data instead of
      skb_transport_header()
      
      B) Adds a nhs parameter to gre_parse_header() so that we can skip the
      not pulled IP header from error path.
        This offset is 0 for normal receive path.
      
      C) remove obsolete IPV6 includes
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Cc: Tom Herbert <tom@herbertland.com>
      Cc: Maciej Żenczykowski <maze@google.com>
      Cc: Jiri Benc <jbenc@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e582615a
    • T
      ila: Fix checksum neutral mapping · 0b797c85
      Tom Herbert 提交于
      The algorithm for checksum neutral mapping is incorrect. This problem
      was being hidden since we were previously always performing checksum
      offload on the translated addresses and only with IPv6 HW csum.
      Enabling an ILA router shows the issue.
      
      Corrected algorithm:
      
      old_loc is the original locator in the packet, new_loc is the value
      to overwrite with and is found in the lookup table. old_flag is
      the old flag value (zero of CSUM_NEUTRAL_FLAG) and new_flag is
      then (old_flag ^ CSUM_NEUTRAL_FLAG) & CSUM_NEUTRAL_FLAG.
      
      Need SUM(new_id + new_flag + diff) == SUM(old_id + old_flag) for
      checksum neutral translation.
      
      Solving for diff gives:
      
      diff = (old_id - new_id) + (old_flag - new_flag)
      
      compute_csum_diff8(new_id, old_id) gives old_id - new_id
      
      If old_flag is set
         old_flag - new_flag = old_flag = CSUM_NEUTRAL_FLAG
      Else
         old_flag - new_flag = -new_flag = ~CSUM_NEUTRAL_FLAG
      
      Tested:
        - Implemented a user space program that creates random addresses
          and random locators to overwrite. Compares the checksum over
          the address before and after translation (must always be equal)
        - Enabled ILA router and showed proper operation.
      Signed-off-by: NTom Herbert <tom@herbertland.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0b797c85