01 Oct, 2009

1 commit

  • This provides safety against negative optlen at the type
    level instead of depending upon (sometimes non-trivial)
    checks against this sprinkled all over the the place, in
    each and every implementation.

    Based upon work done by Arjan van de Ven and feedback
    from Linus Torvalds.

    Signed-off-by: David S. Miller

    David S. Miller
     

03 Sep, 2009

1 commit

  • Christoph Lameter pointed out that packet drops at qdisc level where not
    accounted in SNMP counters. Only if application sets IP_RECVERR, drops
    are reported to user (-ENOBUFS errors) and SNMP counters updated.

    IP_RECVERR is used to enable extended reliable error message passing,
    but these are not needed to update system wide SNMP stats.

    This patch changes things a bit to allow SNMP counters to be updated,
    regardless of IP_RECVERR being set or not on the socket.

    Example after an UDP tx flood
    # netstat -s
    ...
    IP:
    1487048 outgoing packets dropped
    ...
    Udp:
    ...
    SndbufErrors: 1487048

    send() syscalls, do however still return an OK status, to not
    break applications.

    Note : send() manual page explicitly says for -ENOBUFS error :

    "The output queue for a network interface was full.
    This generally indicates that the interface has stopped sending,
    but may be caused by transient congestion.
    (Normally, this does not occur in Linux. Packets are just silently
    dropped when a device queue overflows.) "

    This is not true for IP_RECVERR enabled sockets : a send() syscall
    that hit a qdisc drop returns an ENOBUFS error.

    Many thanks to Christoph, David, and last but not least, Alexey !

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

    Eric Dumazet
     

14 Aug, 2009

1 commit

  • This replaces assignments of the type "int on LHS" = "u8 on RHS" with
    simpler code. The LHS can express all of the unsigned right hand side
    values, hence the assigned value can not be negative.

    Signed-off-by: Gerrit Renker
    Signed-off-by: David S. Miller

    Gerrit Renker
     

23 Jun, 2009

1 commit


18 Jun, 2009

1 commit

  • commit 2b85a34e911bf483c27cfdd124aeb1605145dc80
    (net: No more expensive sock_hold()/sock_put() on each tx)
    changed initial sk_wmem_alloc value.

    We need to take into account this offset when reporting
    sk_wmem_alloc to user, in PROC_FS files or various
    ioctls (SIOCOUTQ/TIOCOUTQ)

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

    Eric Dumazet
     

03 Jun, 2009

1 commit

  • Define three accessors to get/set dst attached to a skb

    struct dst_entry *skb_dst(const struct sk_buff *skb)

    void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)

    void skb_dst_drop(struct sk_buff *skb)
    This one should replace occurrences of :
    dst_release(skb->dst)
    skb->dst = NULL;

    Delete skb->dst field

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

    Eric Dumazet
     

27 Apr, 2009

1 commit

  • The IP MIB (RFC 4293) defines stats for InOctets, OutOctets, InMcastOctets and
    OutMcastOctets:
    http://tools.ietf.org/html/rfc4293
    But it seems we don't track those in any way that easy to separate from other
    protocols. This patch adds those missing counters to the stats file. Tested
    successfully by me

    With help from Eric Dumazet.

    Signed-off-by: Neil Horman
    Signed-off-by: David S. Miller

    Neil Horman
     

26 Nov, 2008

1 commit

  • Pass netns to xfrm_lookup()/__xfrm_lookup(). For that pass netns
    to flow_cache_lookup() and resolver callback.

    Take it from socket or netdevice. Stub DECnet to init_net.

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: David S. Miller

    Alexey Dobriyan
     

09 Oct, 2008

1 commit


30 Aug, 2008

1 commit


19 Jul, 2008

1 commit


18 Jun, 2008

1 commit

  • In commits 33c732c36169d7022ad7d6eb474b0c9be43a2dc1 ([IPV4]: Add raw
    drops counter) and a92aa318b4b369091fd80433c80e62838db8bc1c ([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: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

15 Jun, 2008

1 commit


14 Jun, 2008

1 commit


13 Jun, 2008

1 commit

  • In changeset 22dd485022f3d0b162ceb5e67d85de7c3806aa20
    ("raw: Raw socket leak.") code was added so that we
    flush pending frames on raw sockets to avoid leaks.

    The ipv4 part was fine, but the ipv6 part was not
    done correctly. Unlike the ipv4 side, the ipv6 code
    already has a .destroy method for rawv6_prot.

    So now there were two assignments to this member, and
    what the compiler does is use the last one, effectively
    making the ipv6 parts of that changeset a NOP.

    Fix this by removing the:

    .destroy = inet6_destroy_sock,

    line, and adding an inet6_destroy_sock() call to the
    end of raw6_destroy().

    Noticed by Al Viro.

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

    David S. Miller
     

12 Jun, 2008

1 commit


05 Jun, 2008

2 commits

  • The program below just leaks the raw kernel socket

    int main() {
    int fd = socket(PF_INET, SOCK_RAW, IPPROTO_UDP);
    struct sockaddr_in addr;

    memset(&addr, 0, sizeof(addr));
    inet_aton("127.0.0.1", &addr.sin_addr);
    addr.sin_family = AF_INET;
    addr.sin_port = htons(2048);
    sendto(fd, "a", 1, MSG_MORE, &addr, sizeof(addr));
    return 0;
    }

    Corked packet is allocated via sock_wmalloc which holds the owner socket,
    so one should uncork it and flush all pending data on close. Do this in the
    same way as in UDP.

    Signed-off-by: Denis V. Lunev
    Acked-by: Alexey Kuznetsov
    Signed-off-by: David S. Miller

    Denis V. Lunev
     
  • Signed-off-by: YOSHIFUJI Hideaki

    YOSHIFUJI Hideaki
     

13 May, 2008

1 commit

  • This patch adds needed_headroom/needed_tailroom members to struct
    net_device and updates many places that allocate sbks to use them. Not
    all of them can be converted though, and I'm sure I missed some (I
    mostly grepped for LL_RESERVED_SPACE)

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

    Johannes Berg
     

25 Apr, 2008

1 commit


12 Apr, 2008

2 commits

  • Based on patch from Dmitry Butskoy .

    Closes: 10437
    Signed-off-by: YOSHIFUJI Hideaki

    YOSHIFUJI Hideaki
     
  • This patch fixes a difference between IPv4 and IPv6 when sending packets
    to the unspecified address (either 0.0.0.0 or ::) when using raw or
    un-connected UDP sockets. There are two cases where IPv6 either fails
    to send anything, or sends with the destination address set to ::. For
    example:

    --> ping -c1 0.0.0.0
    PING 0.0.0.0 (127.0.0.1) 56(84) bytes of data.
    64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.032 ms

    --> ping6 -c1 ::
    PING ::(::) 56 data bytes
    ping: sendmsg: Invalid argument

    Doing a sendto("0.0.0.0") reveals:

    10:55:01.495090 IP localhost.32780 > localhost.7639: UDP, length 100

    Doing a sendto("::") reveals:

    10:56:13.262478 IP6 fe80::217:8ff:fe7d:4718.32779 > ::.7639: UDP, length 100

    If you issue a connect() first in the UDP case, it will be sent to ::1,
    similar to what happens with TCP.

    This restores the BSD-ism.

    Signed-off-by: Brian Haley
    Signed-off-by: YOSHIFUJI Hideaki

    Brian Haley
     

05 Apr, 2008

1 commit


02 Apr, 2008

1 commit


29 Mar, 2008

1 commit


26 Mar, 2008

3 commits


25 Mar, 2008

1 commit


23 Mar, 2008

1 commit

  • Sorry for the patch sequence confusion :| but I found that the similar
    thing can be done for raw sockets easily too late.

    Expand the proto.h union with the raw_hashinfo member and use it in
    raw_prot and rawv6_prot. This allows to drop the protocol specific
    versions of hash and unhash callbacks.

    Signed-off-by: Pavel Emelyanov
    Signed-off-by: David S. Miller

    Pavel Emelyanov
     

18 Mar, 2008

1 commit


01 Feb, 2008

3 commits

  • The address of IPv6 raw sockets was shown in the wrong format, from
    IPv4 ones. The problem has been introduced by the commit
    42a73808ed4f30b739eb52bcbb33a02fe62ceef5 ("[RAW]: Consolidate proc
    interface.")

    Thanks to Adrian Bunk who originally noticed the problem.

    Signed-off-by: Denis V. Lunev
    Signed-off-by: David S. Miller

    Denis V. Lunev
     
  • Different hashtables are used for IPv6 and IPv4 raw sockets, so no
    need to check the socket family in the iterator over hashtables. Clean
    this out.

    Signed-off-by: Denis V. Lunev
    Signed-off-by: David S. Miller

    Denis V. Lunev
     
  • A userspace program may wish to set the mark for each packets its send
    without using the netfilter MARK target. Changing the mark can be used
    for mark based routing without netfilter or for packet filtering.

    It requires CAP_NET_ADMIN capability.

    Signed-off-by: Laszlo Attila Toth
    Acked-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Laszlo Attila Toth
     

29 Jan, 2008

6 commits