1. 08 4月, 2013 1 次提交
    • P
      netfilter: ipv4: propagate routing errors from ip_route_me_harder() · c9e1673a
      Patrick McHardy 提交于
      Propagate routing errors from ip_route_me_harder() when dropping a packet
      using NF_DROP_ERR(). This makes userspace get the proper error instead of
      EPERM for everything.
      
      Example:
      
      # ip r a unreachable default table 100
      # ip ru add fwmark 0x1 lookup 100
      # iptables -t mangle -A OUTPUT -d 8.8.8.8 -j MARK --set-mark 0x1
      
      Current behaviour:
      
      PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
      ping: sendmsg: Operation not permitted
      ping: sendmsg: Operation not permitted
      ping: sendmsg: Operation not permitted
      
      New behaviour:
      
      PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
      ping: sendmsg: Network is unreachable
      ping: sendmsg: Network is unreachable
      ping: sendmsg: Network is unreachable
      ping: sendmsg: Network is unreachable
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      c9e1673a
  2. 03 9月, 2012 1 次提交
  3. 30 8月, 2012 1 次提交
  4. 21 4月, 2012 1 次提交
  5. 16 4月, 2012 1 次提交
  6. 22 11月, 2011 1 次提交
    • P
      netfilter: possible unaligned packet header in ip_route_me_harder · 5e2afba4
      Paul Guo 提交于
      This patch tries to fix the following issue in netfilter:
      In ip_route_me_harder(), we invoke pskb_expand_head() that
      rellocates new header with additional head room which can break
      the alignment of the original packet header.
      
      In one of my NAT test case, the NIC port for internal hosts is
      configured with vlan and the port for external hosts is with
      general configuration. If we ping an external "unknown" hosts from an
      internal host, an icmp packet will be sent. We find that in
      icmp_send()->...->ip_route_me_harder()->pskb_expand_head(), hh_len=18
      and current headroom (skb_headroom(skb)) of the packet is 16. After
      calling pskb_expand_head() the packet header becomes to be unaligned
      and then our system (arch/tile) panics immediately.
      Signed-off-by: NPaul Guo <ggang@tilera.com>
      Acked-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      5e2afba4
  7. 01 11月, 2011 1 次提交
  8. 08 8月, 2011 1 次提交
    • J
      netfilter: TCP and raw fix for ip_route_me_harder · 797fd391
      Julian Anastasov 提交于
      TCP in some cases uses different global (raw) socket
      to send RST and ACK. The transparent flag is not set there.
      Currently, it is a problem for rerouting after the previous
      change.
      
      	Fix it by simplifying the checks in ip_route_me_harder
      and use FLOWI_FLAG_ANYSRC even for sockets. It looks safe
      because the initial routing allowed this source address to
      be used and now we just have to make sure the packet is rerouted.
      
      	As a side effect this also allows rerouting for normal
      raw sockets that use spoofed source addresses which was not possible
      even before we eliminated the ip_route_input call.
      Signed-off-by: NJulian Anastasov <ja@ssi.bg>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      797fd391
  9. 29 6月, 2011 1 次提交
    • J
      netfilter: Fix ip_route_me_harder triggering ip_rt_bug · ed6e4ef8
      Julian Anastasov 提交于
      	Avoid creating input routes with ip_route_me_harder.
      It does not work for locally generated packets. Instead,
      restrict sockets to provide valid saddr for output route (or
      unicast saddr for transparent proxy). For other traffic
      allow saddr to be unicast or local but if callers forget
      to check saddr type use 0 for the output route.
      
      	The resulting handling should be:
      
      - REJECT TCP:
      	- in INPUT we can provide addr_type = RTN_LOCAL but
      	better allow rejecting traffic delivered with
      	local route (no IP address => use RTN_UNSPEC to
      	allow also RTN_UNICAST).
      	- FORWARD: RTN_UNSPEC => allow RTN_LOCAL/RTN_UNICAST
      	saddr, add fix to ignore RTN_BROADCAST and RTN_MULTICAST
      	- OUTPUT: RTN_UNSPEC
      
      - NAT, mangle, ip_queue, nf_ip_reroute: RTN_UNSPEC in LOCAL_OUT
      
      - IPVS:
      	- use RTN_LOCAL in LOCAL_OUT and FORWARD after SNAT
      	to restrict saddr to be local
      Signed-off-by: NJulian Anastasov <ja@ssi.bg>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ed6e4ef8
  10. 04 4月, 2011 2 次提交
  11. 13 3月, 2011 2 次提交
  12. 03 3月, 2011 2 次提交
  13. 18 11月, 2010 1 次提交
  14. 14 6月, 2010 1 次提交
  15. 11 6月, 2010 1 次提交
  16. 18 5月, 2010 1 次提交
    • E
      net: add a noref bit on skb dst · 7fee226a
      Eric Dumazet 提交于
      Use low order bit of skb->_skb_dst to tell dst is not refcounted.
      
      Change _skb_dst to _skb_refdst to make sure all uses are catched.
      
      skb_dst() returns the dst, regardless of noref bit set or not, but
      with a lockdep check to make sure a noref dst is not given if current
      user is not rcu protected.
      
      New skb_dst_set_noref() helper to set an notrefcounted dst on a skb.
      (with lockdep check)
      
      skb_dst_drop() drops a reference only if skb dst was refcounted.
      
      skb_dst_force() helper is used to force a refcount on dst, when skb
      is queued and not anymore RCU protected.
      
      Use skb_dst_force() in __sk_add_backlog(), __dev_xmit_skb() if
      !IFF_XMIT_DST_RELEASE or skb enqueued on qdisc queue, in
      sock_queue_rcv_skb(), in __nf_queue().
      
      Use skb_dst_force() in dev_requeue_skb().
      
      Note: dst_use_noref() still dirties dst, we might transform it
      later to do one dirtying per jiffies.
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7fee226a
  17. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  18. 30 11月, 2009 1 次提交
  19. 12 11月, 2009 1 次提交
    • E
      sysctl net: Remove unused binary sysctl code · f8572d8f
      Eric W. Biederman 提交于
      Now that sys_sysctl is a compatiblity wrapper around /proc/sys
      all sysctl strategy routines, and all ctl_name and strategy
      entries in the sysctl tables are unused, and can be
      revmoed.
      
      In addition neigh_sysctl_register has been modified to no longer
      take a strategy argument and it's callers have been modified not
      to pass one.
      
      Cc: "David Miller" <davem@davemloft.net>
      Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
      Cc: netdev@vger.kernel.org
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      f8572d8f
  20. 03 6月, 2009 1 次提交
  21. 26 11月, 2008 1 次提交
  22. 25 11月, 2008 1 次提交
  23. 08 10月, 2008 1 次提交
  24. 01 10月, 2008 1 次提交
  25. 14 4月, 2008 1 次提交
  26. 29 1月, 2008 8 次提交
  27. 16 10月, 2007 2 次提交
  28. 26 4月, 2007 1 次提交
  29. 11 2月, 2007 1 次提交