1. 20 6月, 2008 3 次提交
    • B
      net: Disable LRO on devices that are forwarding · 0187bdfb
      Ben Hutchings 提交于
      Large Receive Offload (LRO) is only appropriate for packets that are
      destined for the host, and should be disabled if received packets may be
      forwarded.  It can also confuse the GSO on output.
      
      Add dev_disable_lro() function which uses the appropriate ethtool ops to
      disable LRO if enabled.
      
      Add calls to dev_disable_lro() in br_add_if() and functions that enable
      IPv4 and IPv6 forwarding.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0187bdfb
    • V
      sctp: Follow security requirement of responding with 1 packet · 2e3216cd
      Vlad Yasevich 提交于
      RFC 4960, Section 11.4. Protection of Non-SCTP-Capable Hosts
      
      When an SCTP stack receives a packet containing multiple control or
      DATA chunks and the processing of the packet requires the sending of
      multiple chunks in response, the sender of the response chunk(s) MUST
      NOT send more than one packet.  If bundling is supported, multiple
      response chunks that fit into a single packet MAY be bundled together
      into one single response packet.  If bundling is not supported, then
      the sender MUST NOT send more than one response chunk and MUST
      discard all other responses.  Note that this rule does NOT apply to a
      SACK chunk, since a SACK chunk is, in itself, a response to DATA and
      a SACK does not require a response of more DATA.
      
      We implement this by not servicing our outqueue until we reach the end
      of the packet.  This enables maximum bundling.  We also identify
      'response' chunks and make sure that we only send 1 packet when sending
      such chunks.
      Signed-off-by: NVlad Yasevich <vladislav.yasevich@hp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2e3216cd
    • W
      sctp: Validate Initiate Tag when handling ICMP message · 7115e632
      Wei Yongjun 提交于
      This patch add to validate initiate tag and chunk type if verification
      tag is 0 when handling ICMP message.
      
      RFC 4960, Appendix C. ICMP Handling
      
      ICMP6) An implementation MUST validate that the Verification Tag
      contained in the ICMP message matches the Verification Tag of the peer.
      If the Verification Tag is not 0 and does NOT match, discard the ICMP
      message.  If it is 0 and the ICMP message contains enough bytes to
      verify that the chunk type is an INIT chunk and that the Initiate Tag
      matches the tag of the peer, continue with ICMP7.  If the ICMP message
      is too short or the chunk type or the Initiate Tag does not match,
      silently discard the packet.
      Signed-off-by: NWei Yongjun <yjwei@cn.fujitsu.com>
      Signed-off-by: NVlad Yasevich <vladislav.yasevich@hp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7115e632
  2. 19 6月, 2008 1 次提交
  3. 18 6月, 2008 20 次提交
    • P
      netlink: genl: fix circular locking · 6d1a3fb5
      Patrick McHardy 提交于
      genetlink has a circular locking dependency when dumping the registered
      families:
      
      - dump start:
      genl_rcv()            : take genl_mutex
      genl_rcv_msg()        : call netlink_dump_start() while holding genl_mutex
      netlink_dump_start(),
      netlink_dump()        : take nlk->cb_mutex
      ctrl_dumpfamily()     : try to detect this case and not take genl_mutex a
                              second time
      
      - dump continuance:
      netlink_rcv()         : call netlink_dump
      netlink_dump          : take nlk->cb_mutex
      ctrl_dumpfamily()     : take genl_mutex
      
      Register genl_lock as callback mutex with netlink to fix this. This slightly
      widens an already existing module unload race, the genl ops used during the
      dump might go away when the module is unloaded. Thomas Graf is working on a
      seperate fix for this.
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6d1a3fb5
    • W
      netdevice: Fix promiscuity and allmulti overflow · dad9b335
      Wang Chen 提交于
      Max of promiscuity and allmulti plus positive @inc can cause overflow.
      Fox example: when allmulti=0xFFFFFFFF, any caller give dev_set_allmulti() a
      positive @inc will cause allmulti be off.
      This is not what we want, though it's rare case.
      The fix is that only negative @inc will cause allmulti or promiscuity be off
      and when any caller makes the counters touch the roof, we return error.
      
      Change of v2:
      Change void function dev_set_promiscuity/allmulti to return int.
      So callers can get the overflow error.
      Caller's fix will be done later.
      
      Change of v3:
      1. Since we return error to caller, we don't need to print KERN_ERROR,
      KERN_WARNING is enough.
      2. In dev_set_promiscuity(), if __dev_set_promiscuity() failed, we
      return at once.
      Signed-off-by: NWang Chen <wangchen@cn.fujitsu.com>
      Acked-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      dad9b335
    • D
      Revert "mac80211: Use skb_header_cloned() on TX path." · 3a5be7d4
      David S. Miller 提交于
      This reverts commit 608961a5.
      
      The problem is that the mac80211 stack not only needs to be able to
      muck with the link-level headers, it also might need to mangle all of
      the packet data if doing sw wireless encryption.
      
      This fixes kernel bugzilla #10903.  Thanks to Didier Raboud (for the
      bugzilla report), Andrew Prince (for bisecting), Johannes Berg (for
      bringing this bisection analysis to my attention), and Ilpo (for
      trying to analyze this purely from the TCP side).
      
      In 2.6.27 we can take another stab at this, by using something like
      skb_cow_data() when the TX path of mac80211 ends up with a non-NULL
      tx->key.  The ESP protocol code in the IPSEC stack can be used as a
      model for implementation.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3a5be7d4
    • R
      ipv6: minor cleanup in net/ipv6/tcp_ipv6.c [RESEND ]. · dd574dbf
      Rami Rosen 提交于
      In net/ipv6/tcp_ipv6.c:
      
        - Remove unneeded tcp_v6_send_check() declaration.
      Signed-off-by: NRami Rosen <ramirose@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      dd574dbf
    • D
      net: Add sk_set_socket() helper. · 972692e0
      David S. Miller 提交于
      In order to more easily grep for all things that set
      sk->sk_socket, add sk_set_socket() helper inline function.
      
      Suggested (although only half-seriously) by Evgeniy Polyakov.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      972692e0
    • R
      af_unix: fix 'poll for write'/ connected DGRAM sockets · 3c73419c
      Rainer Weikusat 提交于
      The unix_dgram_sendmsg routine implements a (somewhat crude)
      form of receiver-imposed flow control by comparing the length of the
      receive queue of the 'peer socket' with the max_ack_backlog value
      stored in the corresponding sock structure, either blocking
      the thread which caused the send-routine to be called or returning
      EAGAIN. This routine is used by both SOCK_DGRAM and SOCK_SEQPACKET
      sockets. The poll-implementation for these socket types is
      datagram_poll from core/datagram.c. A socket is deemed to be writeable
      by this routine when the memory presently consumed by datagrams
      owned by it is less than the configured socket send buffer size. This
      is always wrong for connected PF_UNIX non-stream sockets when the
      abovementioned receive queue is currently considered to be full.
      'poll' will then return, indicating that the socket is writeable, but
      a subsequent write result in EAGAIN, effectively causing an
      (usual) application to 'poll for writeability by repeated send request
      with O_NONBLOCK set' until it has consumed its time quantum.
      
      The change below uses a suitably modified variant of the datagram_poll
      routines for both type of PF_UNIX sockets, which tests if the
      recv-queue of the peer a socket is connected to is presently
      considered to be 'full' as part of the 'is this socket
      writeable'-checking code. The socket being polled is additionally
      put onto the peer_wait wait queue associated with its peer, because the
      unix_dgram_sendmsg routine does a wake up on this queue after a
      datagram was received and the 'other wakeup call' is done implicitly
      as part of skb destruction, meaning, a process blocked in poll
      because of a full peer receive queue could otherwise sleep forever
      if no datagram owned by its socket was already sitting on this queue.
      Among this change is a small (inline) helper routine named
      'unix_recvq_full', which consolidates the actual testing code (in three
      different places) into a single location.
      Signed-off-by: NRainer Weikusat <rweikusat@mssgmbh.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3c73419c
    • D
      ax25: Fix std timer socket destroy handling. · 30902dc3
      David S. Miller 提交于
      Tihomir Heidelberg - 9a4gl, reports:
      
      --------------------
      I would like to direct you attention to one problem existing in ax.25
      kernel since 2.4. If listening socket is closed and its SKB queue is
      released but those sockets get weird. Those "unAccepted()" sockets
      should be destroyed in ax25_std_heartbeat_expiry, but it will not
      happen. And there is also a note about that in ax25_std_timer.c:
      /* Magic here: If we listen() and a new link dies before it
      is accepted() it isn't 'dead' so doesn't get removed. */
      
      This issue cause ax25d to stop accepting new connections and I had to
      restarted ax25d approximately each day and my services were unavailable.
      Also netstat -n -l shows invalid source and device for those listening
      sockets. It is strange why ax25d's listening socket get weird because of
      this issue, but definitely when I solved this bug I do not have problems
      with ax25d anymore and my ax25d can run for months without problems.
      --------------------
      
      Actually as far as I can see, this problem is even in releases
      as far back as 2.2.x as well.
      
      It seems senseless to special case this test on TCP_LISTEN state.
      Anything still stuck in state 0 has no external references and
      we can just simply kill it off directly.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      30902dc3
    • E
      udp: sk_drops handling · cb61cb9b
      Eric Dumazet 提交于
      In commits 33c732c3 ([IPV4]: Add raw
      drops counter) and a92aa318 ([IPV6]:
      Add raw drops counter), Wang Chen added raw drops counter for
      /proc/net/raw & /proc/net/raw6
      
      This patch adds this capability to UDP sockets too (/proc/net/udp &
      /proc/net/udp6).
      
      This means that 'RcvbufErrors' errors found in /proc/net/snmp can be also
      be examined for each udp socket.
      
      # grep Udp: /proc/net/snmp
      Udp: InDatagrams NoPorts InErrors OutDatagrams RcvbufErrors SndbufErrors
      Udp: 23971006 75 899420 16390693 146348 0
      
      # cat /proc/net/udp
       sl  local_address rem_address   st tx_queue rx_queue tr tm->when retrnsmt  ---
      uid  timeout inode ref pointer drops
       75: 00000000:02CB 00000000:0000 07 00000000:00000000 00:00000000 00000000  ---
        0        0 2358 2 ffff81082a538c80 0
      111: 00000000:006F 00000000:0000 07 00000000:00000000 00:00000000 00000000  ---
        0        0 2286 2 ffff81042dd35c80 146348
      
      In this example, only port 111 (0x006F) was flooded by messages that
      user program could not read fast enough. 146348 messages were lost.
      Signed-off-by: NEric Dumazet <dada1@cosmosbay.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cb61cb9b
    • J
      bonding: Allow setting max_bonds to zero · b8a9787e
      Jay Vosburgh 提交于
      	Permit bonding to function rationally if max_bonds is set to
      zero.  This will load the module, but create no master devices (which can
      be created via sysfs).
      
      	Requires some change to bond_create_sysfs; currently, the
      netdev sysfs directory is determined from the first bonding device created,
      but this is no longer possible.  Instead, an interface from net/core is
      created to create and destroy files in net_class.
      
      	Based on a patch submitted by Phil Oester <kernel@linuxaces.com>.
      Modified by Jay Vosburgh to fix the sysfs issue mentioned above and to
      update the documentation.
      Signed-off-by: NPhil Oester <kernel@linuxace.com>
      Signed-off-by: NJay Vosburgh <fubar@us.ibm.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      b8a9787e
    • O
      net/core: add NETDEV_BONDING_FAILOVER event · c1da4ac7
      Or Gerlitz 提交于
      Add NETDEV_BONDING_FAILOVER event to be used in a successive patch
      by bonding to announce fail-over for the active-backup mode through the
      netdev events notifier chain mechanism. Such an event can be of use for the
      RDMA CM (communication manager) to let native RDMA ULPs (eg NFS-RDMA, iSER)
      always be aligned with the IP stack, in the sense that they use the same
      ports/links as the stack does. More usages can be done to allow monitoring
      tools based on netlink events being aware to bonding fail-over.
      Signed-off-by: NOr Gerlitz <ogerlitz@voltaire.com>
      Signed-off-by: NJay Vosburgh <fubar@us.ibm.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      c1da4ac7
    • B
      rose: improving AX25 routing frames via ROSE network · fe2c802a
      Bernard Pidoux 提交于
      ROSE network is organized through nodes connected via hamradio or Internet.
      AX25 packet radio frames sent to a remote ROSE address destination are routed
      through these nodes.
      
      Without the present patch, automatic routing mechanism did not work optimally
      due to an improper parameter checking.
      
      rose_get_neigh() function is called either by rose_connect() or by
      rose_route_frame().
      
      In the case of a call from rose_connect(), f0 timer is checked to find if a connection
      is already pending. In that case it returns the address of the neighbour, or returns a NULL otherwise.
      
      When called by rose_route_frame() the purpose was to route a packet AX25 frame
      through an adjacent node given a destination rose address.
      However, in that case, t0 timer checked does not indicate if the adjacent node
      is actually connected even if the timer is not null. Thus, for each frame sent, the
      function often tried to start a new connexion even if the adjacent node was already connected.
      
      The patch adds a "new" parameter that is true when the function is called by
      rose route_frame().
      This instructs rose_get_neigh() to check node parameter "restarted". 
      If restarted is true it means that the route to the destination address is opened via a neighbour
      node already connected.
      If "restarted" is false the function returns a NULL.
      In that case the calling function will initiate a new connection as before.
      
      This results in a fast routing of frames, from nodes to nodes, until
      destination is reached, as originaly specified by ROSE protocole.
      Signed-off-by: NBernard Pidoux <f6bvp@amsat.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fe2c802a
    • S
      xfrm: fix fragmentation for ipv4 xfrm tunnel · fe833fca
      Steffen Klassert 提交于
      When generating the ip header for the transformed packet we just copy
      the frag_off field of the ip header from the original packet to the ip
      header of the new generated packet. If we receive a packet as a chain
      of fragments, all but the last of the new generated packets have the
      IP_MF flag set. We have to mask the frag_off field to only keep the
      IP_DF flag from the original packet. This got lost with git commit
      36cf9acf ("[IPSEC]: Separate
      inner/outer mode processing on output")
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      Acked-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fe833fca
    • M
      atm: use const where reasonable · 61c33e01
      Mitchell Blank Jr 提交于
      From: Mitchell Blank Jr <mitch@sfgoth.com>
      Signed-off-by: NChas Williams <chas@cmf.nrl.navy.mil>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      61c33e01
    • R
      bridge: fix IPV6=n build · f586287e
      Randy Dunlap 提交于
      Fix bridge netfilter code so that it uses CONFIG_IPV6 as needed:
      
      net/built-in.o: In function `ebt_filter_ip6':
      ebt_ip6.c:(.text+0x87c37): undefined reference to `ipv6_skip_exthdr'
      net/built-in.o: In function `ebt_log_packet':
      ebt_log.c:(.text+0x88dee): undefined reference to `ipv6_skip_exthdr'
      make[1]: *** [.tmp_vmlinux1] Error 1
      Signed-off-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f586287e
    • S
      bridge: make bridge address settings sticky · 92c0574f
      Stephen Hemminger 提交于
      Normally, the bridge just chooses the smallest mac address as the
      bridge id and mac address of bridge device. But if the administrator
      has explictly set the interface address then don't change it.
      Signed-off-by: NStephen Hemminger <shemminger@vyatta.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      92c0574f
    • S
      bridge: handle process all link-local frames · 43aa1920
      Stephen Hemminger 提交于
      Any frame addressed to link-local addresses should be processed by local
      receive path. The earlier code would process them only if STP was enabled.
      Since there are other frames like LACP for bonding, we should always
      process them.
      Signed-off-by: NStephen Hemminger <shemminger@vyatta.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      43aa1920
    • P
      sctp: fix error path in sctp_proc_init · 3d00fb9e
      Pavel Emelyanov 提交于
      After the sctp_remaddr_proc_init failed, the proper rollback is
      not the sctp_remaddr_proc_exit, but the sctp_assocs_proc_exit.
      Signed-off-by: NPavel Emelyanov <xemul@openvz.org>
      Acked-by: NVlad Yasevich <vladislav.yasevich@hp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3d00fb9e
    • P
      netfilter: nf_conntrack_h323: fix module unload crash · a56b8f81
      Patrick McHardy 提交于
      The H.245 helper is not registered/unregistered, but assigned to
      connections manually from the Q.931 helper. This means on unload
      existing expectations and connections using the helper are not
      cleaned up, leading to the following oops on module unload:
      
      CPU 0 Unable to handle kernel paging request at virtual address c00a6828, epc == 802224dc, ra == 801d4e7c
      Oops[#1]:
      Cpu 0
      $ 0   : 00000000 00000000 00000004 c00a67f0
      $ 4   : 802a5ad0 81657e00 00000000 00000000
      $ 8   : 00000008 801461c8 00000000 80570050
      $12   : 819b0280 819b04b0 00000006 00000000
      $16   : 802a5a60 80000000 80b46000 80321010
      $20   : 00000000 00000004 802a5ad0 00000001
      $24   : 00000000 802257a8
      $28   : 802a4000 802a59e8 00000004 801d4e7c
      Hi    : 0000000b
      Lo    : 00506320
      epc   : 802224dc ip_conntrack_help+0x38/0x74     Tainted: P
      ra    : 801d4e7c nf_iterate+0xbc/0x130
      Status: 1000f403    KERNEL EXL IE
      Cause : 00800008
      BadVA : c00a6828
      PrId  : 00019374
      Modules linked in: ip_nat_pptp ip_conntrack_pptp ath_pktlog wlan_acl wlan_wep wlan_tkip wlan_ccmp wlan_xauth ath_pci ath_dev ath_dfs ath_rate_atheros wlan ath_hal ip_nat_tftp ip_conntrack_tftp ip_nat_ftp ip_conntrack_ftp pppoe ppp_async ppp_deflate ppp_mppe pppox ppp_generic slhc
      Process swapper (pid: 0, threadinfo=802a4000, task=802a6000)
      Stack : 801e7d98 00000004 802a5a60 80000000 801d4e7c 801d4e7c 802a5ad0 00000004
              00000000 00000000 801e7d98 00000000 00000004 802a5ad0 00000000 00000010
              801e7d98 80b46000 802a5a60 80320000 80000000 801d4f8c 802a5b00 00000002
              80063834 00000000 80b46000 802a5a60 801e7d98 80000000 802ba854 00000000
              81a02180 80b7e260 81a021b0 819b0000 819b0000 80570056 00000000 00000001
              ...
      Call Trace:
       [<801e7d98>] ip_finish_output+0x0/0x23c
       [<801d4e7c>] nf_iterate+0xbc/0x130
       [<801d4e7c>] nf_iterate+0xbc/0x130
       [<801e7d98>] ip_finish_output+0x0/0x23c
       [<801e7d98>] ip_finish_output+0x0/0x23c
       [<801d4f8c>] nf_hook_slow+0x9c/0x1a4
      
      One way to fix this would be to split helper cleanup from the unregistration
      function and invoke it for the H.245 helper, but since ctnetlink needs to be
      able to find the helper for synchonization purposes, a better fix is to
      register it normally and make sure its not assigned to connections during
      helper lookup. The missing l3num initialization is enough for this, this
      patch changes it to use AF_UNSPEC to make it more explicit though.
      Reported-by: Nliannan <liannan@twsz.com>
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a56b8f81
    • P
      netfilter: nf_conntrack_h323: fix memory leak in module initialization error path · 8a548868
      Patrick McHardy 提交于
      Properly free h323_buffer when helper registration fails.
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8a548868
    • P
      netfilter: nf_nat: fix RCU races · 68b80f11
      Patrick McHardy 提交于
      Fix three ct_extend/NAT extension related races:
      
      - When cleaning up the extension area and removing it from the bysource hash,
        the nat->ct pointer must not be set to NULL since it may still be used in
        a RCU read side
      
      - When replacing a NAT extension area in the bysource hash, the nat->ct
        pointer must be assigned before performing the replacement
      
      - When reallocating extension storage in ct_extend, the old memory must
        not be freed immediately since it may still be used by a RCU read side
      
      Possibly fixes https://bugzilla.redhat.com/show_bug.cgi?id=449315
      and/or http://bugzilla.kernel.org/show_bug.cgi?id=10875Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      68b80f11
  4. 17 6月, 2008 16 次提交