04 Oct, 2011

1 commit


27 Aug, 2011

1 commit


25 Aug, 2011

1 commit


06 Jul, 2011

3 commits

  • Unfortunately we have to use a real modulus here as
    the multiply trick won't work as effectively with cpu
    numbers as it does with rxhash values.

    Signed-off-by: David S. Miller

    David S. Miller
     
  • The skb->rxhash cannot be properly computed if the
    packet is a fragment. To alleviate this, allow the
    AF_PACKET client to ask for defragmentation to be
    done at demux time.

    Signed-off-by: David S. Miller

    David S. Miller
     
  • Fanouts allow packet capturing to be demuxed to a set of AF_PACKET
    sockets. Two fanout policies are implemented:

    1) Hashing based upon skb->rxhash

    2) Pure round-robin

    An AF_PACKET socket must be fully bound before it tries to add itself
    to a fanout. All AF_PACKET sockets trying to join the same fanout
    must all have the same bind settings.

    Fanouts are identified (within a network namespace) by a 16-bit ID.
    The first socket to try to add itself to a fanout with a particular
    ID, creates that fanout. When the last socket leaves the fanout
    (which happens only when the socket is closed), that fanout is
    destroyed.

    Signed-off-by: David S. Miller

    David S. Miller
     

07 Jun, 2011

1 commit

  • In 2.6.27, commit 393e52e33c6c2 (packet: deliver VLAN TCI to userspace)
    added a small information leak.

    Add padding field and make sure its zeroed before copy to user.

    Signed-off-by: Eric Dumazet
    CC: Patrick McHardy
    Signed-off-by: David S. Miller

    Eric Dumazet
     

02 Jun, 2011

1 commit

  • Currently, user-space cannot determine if a 0 tcp_vlan_tci
    means there is no VLAN tag or the VLAN ID was zero.

    Add flag to make this explicit. User-space can check for
    TP_STATUS_VLAN_VALID || tp_vlan_tci > 0, which will be backwards
    compatible. Older could would have just checked for tp_vlan_tci,
    so it will work no worse than before.

    Signed-off-by: Ben Greear
    Acked-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Ben Greear
     

02 Jun, 2010

1 commit

  • This patch adds a setting, PACKET_TIMESTAMP, to specify the packet
    timestamp source that is exported to capture utilities like tcpdump by
    packet_mmap.

    PACKET_TIMESTAMP accepts the same integer bit field as
    SO_TIMESTAMPING. However, only the SOF_TIMESTAMPING_SYS_HARDWARE and
    SOF_TIMESTAMPING_RAW_HARDWARE values are currently recognized by
    PACKET_TIMESTAMP. SOF_TIMESTAMPING_SYS_HARDWARE takes precedence over
    SOF_TIMESTAMPING_RAW_HARDWARE if both bits are set.

    If PACKET_TIMESTAMP is not set, a software timestamp generated inside
    the networking stack is used (the behavior before this setting was
    added).

    Signed-off-by: Scott McMillan
    Signed-off-by: David S. Miller

    Scott McMillan
     

13 Apr, 2010

1 commit

  • Enable the SO_TIMESTAMPING socket infrastructure for raw packet sockets.
    We introduce PACKET_TX_TIMESTAMP for the control message cmsg_type.

    Similar support for UDP and CAN sockets was added in commit
    51f31cabe3ce5345b51e4a4f82138b38c4d5dc91

    Signed-off-by: Richard Cochran
    Signed-off-by: David S. Miller

    Richard Cochran
     

05 Feb, 2010

1 commit

  • This patch adds GSO/checksum offload to af_packet sockets using
    virtio_net_hdr. Based on Rusty's patch to add this support to tun.
    It allows GSO/checksum offload to be enabled when using raw socket
    backend with virtio_net.
    Adds PACKET_VNET_HDR socket option to prepend virtio_net_hdr in the
    receive path and process/skip virtio_net_hdr in the send path. This
    option is only allowed with SOCK_RAW sockets attached to ethernet
    type devices.

    v2 updates
    ----------
    Michael's Comments
    - Perform length check in packet_snd() when GSO is off even when
    vnet_hdr is present.
    - Check for SKB_GSO_FCOE type and return -EINVAL
    - don't allow tx/rx ring when vnet_hdr is enabled.
    Herbert's Comments
    - Removed ethernet specific code.
    - protocol value is assumed to be passed in by the caller.

    Signed-off-by: Sridhar Samudrala
    Signed-off-by: David S. Miller

    Sridhar Samudrala
     

05 Nov, 2009

1 commit

  • This cleanup patch puts struct/union/enum opening braces,
    in first line to ease grep games.

    struct something
    {

    becomes :

    struct something {

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

    Eric Dumazet
     

12 Oct, 2009

1 commit


05 Oct, 2009

1 commit

  • Add Ancilliary data to better represent loss information

    I've had a few requests recently to provide more detail regarding frame loss
    during an AF_PACKET packet capture session. Specifically the requestors want to
    see where in a packet sequence frames were lost, i.e. they want to see that 40
    frames were lost between frames 302 and 303 in a packet capture file. In order
    to do this we need:

    1) The kernel to export this data to user space
    2) The applications to make use of it

    This patch addresses item (1). It does this by doing the following:

    A) Anytime we drop a frame for which we would increment po->stats.tp_drops, we
    also no increment a stats called po->stats.tp_gap.

    B) Every time we successfully enqueue a frame to sk_receive_queue, we record the
    value of po->stats.tp_gap in skb->mark. skb->cb would nominally be the place to
    record this, but since all the space there is used up, we're overloading
    skb->mark. Its safe to do since any enqueued packet is guaranteed to be
    unshared at this point, and skb->mark isn't used for anything else in the rx
    path to the application. After we record tp_gap in the skb, we zero
    po->stats.tp_gap. This allows us to keep a counter of the number of frames lost
    between any two enqueued packets

    C) When the application goes to dequeue a frame from the packet socket, we look
    at skb->mark for that frame. If it is non-zero, we add a cmsg chunk to the
    msghdr of level SOL_PACKET and type PACKET_GAPDATA. Its a 32 bit integer that
    represents the number of frames lost between this packet and the last previous
    frame received.

    Note there is a chance that if there is frame loss after a receive, and then the
    socket is closed, some gap data might be lost. This is covered by the use of
    the PACKET_AUXDATA socket option, which gives total loss data. With a bit of
    math, the final gap can be determined that way.

    I've tested this patch myself, and it works well.

    Signed-off-by: Neil Horman
    Signed-off-by: Eric Dumazet

    include/linux/if_packet.h | 2 ++
    net/packet/af_packet.c | 33 +++++++++++++++++++++++++++++++++
    2 files changed, 35 insertions(+)
    Signed-off-by: David S. Miller

    Neil Horman
     

22 May, 2009

1 commit

  • The the PACKET_ADD_MEMBERSHIP and the PACKET_DROP_MEMBERSHIP setsockopt
    calls for af_packet already has all of the infrastructure needed to subscribe
    to multiple mac addresses. All that is missing is a flag to say that
    the address we want to listen on is a unicast address.

    So introduce PACKET_MR_UNICAST and wire it up to dev_unicast_add and
    dev_unicast_delete.

    Additionally I noticed that errors from dev_mc_add were not propagated
    from packet_dev_mc so fix that.

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

    Eric W. Biederman
     

19 May, 2009

1 commit

  • New packet socket feature that makes packet socket more efficient for
    transmission.

    - It reduces number of system call through a PACKET_TX_RING mechanism,
    based on PACKET_RX_RING (Circular buffer allocated in kernel space
    which is mmapped from user space).

    - It minimizes CPU copy using fragmented SKB (almost zero copy).

    Signed-off-by: Johann Baudy
    Signed-off-by: David S. Miller

    Johann Baudy
     

19 Jul, 2008

1 commit

  • Add new sockopt to reserve some headroom in the mmaped ring frames in
    front of the packet payload. This can be used f.i. when the VLAN header
    needs to be (re)constructed to avoid moving the entire payload.

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     

15 Jul, 2008

2 commits

  • Store the VLAN tag in the auxillary data/tpacket2_hdr so userspace can
    properly deal with hardware VLAN tagging/stripping.

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     
  • The tpacket_hdr is not 64 bit clean due to use of an unsigned long
    and can't be extended because the following struct sockaddr_ll needs
    to be at a fixed offset.

    Add support for a version 2 tpacket protocol that removes these
    limitations.

    Userspace can query the header size through a new getsockopt option
    and change the protocol version through a setsockopt option. The
    changes needed to switch to the new protocol version are:

    1. replace struct tpacket_hdr by struct tpacket2_hdr
    2. query header len and save
    3. set protocol version to 2
    - set up ring as usual
    4. for getting the sockaddr_ll, use (void *)hdr + TPACKET_ALIGN(hdrlen)
    instead of (void *)hdr + TPACKET_ALIGN(sizeof(struct tpacket_hdr))

    Steps 2 and 4 can be omitted if the struct sockaddr_ll isn't needed.

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     

26 Apr, 2007

1 commit

  • Add a packet socket option to allow the orig_dev index to be returned
    to userspace when passing traffic through a decapsulated device, such
    as the bonding driver.

    This is very useful for layer 2 traffic being able to report which
    physical device actually received the traffic, instead of having the
    encapsulating device hide that information.

    The new option is called PACKET_ORIGDEV.

    Signed-off-by: Peter P. Waskiewicz Jr.
    Signed-off-by: David S. Miller

    Peter P. Waskiewicz Jr
     

09 Feb, 2007

1 commit

  • This patch is needed to make ISC's DHCP server (and probably other
    DHCP servers/clients using AF_PACKET) to be able to serve another
    client on the same Xen host.

    The problem is that packets between different domains on the same
    Xen host only have partial checksums. Unfortunately this piece of
    information is not passed along in AF_PACKET unless you're using
    the mmap interface. Since dhcpd doesn't support packet-mmap, UDP
    packets from the same host come out with apparently bogus checksums.

    This patch adds a mechanism for AF_PACKET recvmsg(2) to return the
    status along with the packet. It does so by adding a new cmsg that
    contains this information along with some other relevant data such
    as the original packet length.

    I didn't include the time stamp information since there is already
    a cmsg for that.

    This patch also changes the mmap code to set the CSUMNOTREADY flag
    on all packets instead of just outoing packets on cooked sockets.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     

03 Dec, 2006

1 commit

  • Weirdness: the third argument of socket() is net-endian
    here. Oh, well - it's documented in packet(7).

    Signed-off-by: Al Viro
    Signed-off-by: David S. Miller

    Al Viro
     

17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds