30 May, 2018

1 commit

  • [ Upstream commit cbe7128c4b92e2004984f477fd38dfa81662f02e ]

    With reorder header off, received packets are untagged in skb_vlan_untag()
    called from within __netif_receive_skb_core(), and later the tag will be
    inserted back in vlan_do_receive().

    This caused out of order vlan headers when we create a vlan device on top
    of another vlan device, because vlan_do_receive() inserts a tag as the
    outermost vlan tag. E.g. the outer tag is first removed in skb_vlan_untag()
    and inserted back in vlan_do_receive(), then the inner tag is next removed
    and inserted back as the outermost tag.

    This patch fixes the behaviour by inserting the inner tag at the right
    position.

    Signed-off-by: Toshiaki Makita
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Toshiaki Makita
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

05 Oct, 2017

1 commit

  • If the vlan is down, free the packet instead of proceeding with other
    processing, or counting it as received. If vlan interfaces are used
    as slaves for bonding, with arp monitoring for connectivity, if the rx
    counter is seen to be incrementing, then the bond device will not
    observe that the interface is down.

    CC: David S. Miller
    Signed-off-by: Vishakha Narvekar
    Signed-off-by: David S. Miller

    Vishakha Narvekar
     

18 Nov, 2015

1 commit

  • When a vlan is configured with REORDER_HEADER set to 0, the vlan
    header is put back into the packet and makes it appear that
    the vlan header is still there even after it's been processed.
    This posses a problem for bridge and macvlan ports. The packets
    passed to those device may be forwarded and at the time of the
    forward, vlan headers end up being unexpectedly present.

    With the patch, we make sure that we do not put the vlan header
    back (when REORDER_HEADER is 0) if a bridge or macvlan has
    been configured on top of the vlan device.

    Signed-off-by: Vladislav Yasevich
    Signed-off-by: David S. Miller

    Vlad Yasevich
     

04 Nov, 2015

1 commit


14 Jan, 2015

1 commit


12 Aug, 2014

1 commit

  • Currently the functionality to untag traffic on input resides
    as part of the vlan module and is build only when VLAN support
    is enabled in the kernel. When VLAN is disabled, the function
    vlan_untag() turns into a stub and doesn't really untag the
    packets. This seems to create an interesting interaction
    between VMs supporting checksum offloading and some network drivers.

    There are some drivers that do not allow the user to change
    tx-vlan-offload feature of the driver. These drivers also seem
    to assume that any VLAN-tagged traffic they transmit will
    have the vlan information in the vlan_tci and not in the vlan
    header already in the skb. When transmitting skbs that already
    have tagged data with partial checksum set, the checksum doesn't
    appear to be updated correctly by the card thus resulting in a
    failure to establish TCP connections.

    The following is a packet trace taken on the receiver where a
    sender is a VM with a VLAN configued. The host VM is running on
    doest not have VLAN support and the outging interface on the
    host is tg3:
    10:12:43.503055 52:54:00:ae:42:3f > 28:d2:44:7d:c2:de, ethertype 802.1Q
    (0x8100), length 78: vlan 100, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 27243,
    offset 0, flags [DF], proto TCP (6), length 60)
    10.0.100.1.58545 > 10.0.100.10.ircu-2: Flags [S], cksum 0xdc39 (incorrect
    -> 0x48d9), seq 1069378582, win 29200, options [mss 1460,sackOK,TS val
    4294837885 ecr 0,nop,wscale 7], length 0
    10:12:44.505556 52:54:00:ae:42:3f > 28:d2:44:7d:c2:de, ethertype 802.1Q
    (0x8100), length 78: vlan 100, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 27244,
    offset 0, flags [DF], proto TCP (6), length 60)
    10.0.100.1.58545 > 10.0.100.10.ircu-2: Flags [S], cksum 0xdc39 (incorrect
    -> 0x44ee), seq 1069378582, win 29200, options [mss 1460,sackOK,TS val
    4294838888 ecr 0,nop,wscale 7], length 0

    This connection finally times out.

    I've only access to the TG3 hardware in this configuration thus have
    only tested this with TG3 driver. There are a lot of other drivers
    that do not permit user changes to vlan acceleration features, and
    I don't know if they all suffere from a similar issue.

    The patch attempt to fix this another way. It moves the vlan header
    stipping code out of the vlan module and always builds it into the
    kernel network core. This way, even if vlan is not supported on
    a virtualizatoin host, the virtual machines running on top of such
    host will still work with VLANs enabled.

    CC: Patrick McHardy
    CC: Nithin Nayak Sujir
    CC: Michael Chan
    CC: Jiri Pirko
    Signed-off-by: Vladislav Yasevich
    Acked-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Vlad Yasevich
     

22 Jun, 2014

1 commit

  • skb_cow called in vlan_reorder_header does not free the skb when it failed,
    and vlan_reorder_header returns NULL to reset original skb when it is called
    in vlan_untag, lead to a memory leak.

    Signed-off-by: Li RongQing
    Acked-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Li RongQing
     

13 May, 2014

1 commit


27 Mar, 2014

1 commit


10 Mar, 2014

2 commits

  • Ether_addr_equal_64bits is more efficient than ether_addr_equal, and
    can be used when each argument is an array within a structure that
    contains at least two bytes of data beyond the array, so it is safe
    to use it for vlan, and make sense for fast path.

    Cc: Joe Perches
    Cc: Patrick McHardy
    Cc: David S. Miller
    Signed-off-by: Ding Tianhong
    Signed-off-by: David S. Miller

    dingtianhong
     
  • According Joe's suggestion, maybe it'd be faster to add an unlikely to
    the test for PCKET_OTHERHOST, so I add it and see whether the performance
    could be better, although the differences is so small and negligible, but
    it is hard to catch that any lower device would set the skb type to
    PACKET_OTHERHOST, so most of time, I think it make sense to add unlikely
    for the test.

    Cc: Joe Perches
    Cc: Patrick McHardy
    Cc: David S. Miller
    Signed-off-by: Ding Tianhong
    Signed-off-by: David S. Miller

    dingtianhong
     

06 Aug, 2013

1 commit

  • Sometimes we might have stacked vlans on top of each other, and we're
    interested in the first non-vlan real device on the path, so transform
    vlan_dev_real_dev to go over the stacked vlans and extract the first
    non-vlan device.

    Signed-off-by: Nikolay Aleksandrov
    Signed-off-by: Veaceslav Falico
    Signed-off-by: David S. Miller

    nikolay@redhat.com
     

19 Jul, 2013

1 commit

  • In commit 48cc32d38a52d0b68f91a171a8d00531edc6a46e
    ("vlan: don't deliver frames for unknown vlans to protocols")
    Florian made sure we set pkt_type to PACKET_OTHERHOST
    if the vlan id is set and we could find a vlan device for this
    particular id.

    But we also have a problem if prio bits are set.

    Steinar reported an issue on a router receiving IPv6 frames with a
    vlan tag of 4000 (id 0, prio 2), and tunneled into a sit device,
    because skb->vlan_tci is set.

    Forwarded frame is completely corrupted : We can see (8100:4000)
    being inserted in the middle of IPv6 source address :

    16:48:00.780413 IP6 2001:16d8:8100:4000:ee1c:0:9d9:bc87 >
    9f94:4d95:2001:67c:29f4::: ICMP6, unknown icmp6 type (0), length 64
    0x0000: 0000 0029 8000 c7c3 7103 0001 a0ae e651
    0x0010: 0000 0000 ccce 0b00 0000 0000 1011 1213
    0x0020: 1415 1617 1819 1a1b 1c1d 1e1f 2021 2223
    0x0030: 2425 2627 2829 2a2b 2c2d 2e2f 3031 3233

    It seems we are not really ready to properly cope with this right now.

    We can probably do better in future kernels :
    vlan_get_ingress_priority() should be a netdev property instead of
    a per vlan_dev one.

    For stable kernels, lets clear vlan_tci to fix the bugs.

    Reported-by: Steinar H. Gunderson
    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

22 Apr, 2013

1 commit

  • The following leak is reported by kmemleak:

    [ 86.812073] kmemleak: Found object by alias at 0xffff88006ecc76f0
    [ 86.816019] Pid: 739, comm: kworker/u:1 Not tainted 3.9.0-rc5+ #842
    [ 86.816019] Call Trace:
    [ 86.816019] [] find_and_get_object+0x8c/0xdf
    [ 86.816019] [] ? vlan_info_rcu_free+0x33/0x49
    [ 86.816019] [] delete_object_full+0x13/0x2f
    [ 86.816019] [] kmemleak_free+0x26/0x45
    [ 86.816019] [] slab_free_hook+0x1e/0x7b
    [ 86.816019] [] kfree+0xce/0x14b
    [ 86.816019] [] vlan_info_rcu_free+0x33/0x49
    [ 86.816019] [] rcu_do_batch+0x261/0x4e7

    The reason is that in vlan_info_rcu_free() we don't take the VLAN protocol
    into account when iterating over the vlan_devices_array.

    Reported-by: Cong Wang
    Signed-off-by: Patrick McHardy
    Tested-by: Cong Wang
    Signed-off-by: David S. Miller

    Patrick McHardy
     

20 Apr, 2013

5 commits

  • Add support for 802.1ad VLAN devices. This mainly consists of checking for
    ETH_P_8021AD in addition to ETH_P_8021Q in a couple of places and check
    offloading capabilities based on the used protocol.

    Configuration is done using "ip link":

    # ip link add link eth0 eth0.1000 \
    type vlan proto 802.1ad id 1000
    # ip link add link eth0.1000 eth0.1000.1000 \
    type vlan proto 802.1q id 1000

    52:54:00:12:34:56 > 92:b1:54:28:e4:8c, ethertype 802.1Q (0x8100), length 106: vlan 1000, p 0, ethertype 802.1Q, vlan 1000, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto ICMP (1), length 84)
    20.1.0.2 > 20.1.0.1: ICMP echo request, id 3003, seq 8, length 64
    92:b1:54:28:e4:8c > 52:54:00:12:34:56, ethertype 802.1Q-QinQ (0x88a8), length 106: vlan 1000, p 0, ethertype 802.1Q, vlan 1000, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 47944, offset 0, flags [none], proto ICMP (1), length 84)
    20.1.0.1 > 20.1.0.2: ICMP echo reply, id 3003, seq 8, length 64

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

    Patrick McHardy
     
  • Add a protocol argument to the VLAN packet tagging functions. In case of HW
    tagging, we need that protocol available in the ndo_start_xmit functions,
    so it is stored in a new field in the skb. The new field fits into a hole
    (on 64 bit) and doesn't increase the sks's size.

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

    Patrick McHardy
     
  • Make the encapsulation protocol value a property of VLAN devices and change
    the device lookup functions to take the protocol value into account.

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

    Patrick McHardy
     
  • Change the rx_{add,kill}_vid callbacks to take a protocol argument in
    preparation of 802.1ad support. The protocol argument used so far is
    always htons(ETH_P_8021Q).

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

    Patrick McHardy
     
  • Rename the hardware VLAN acceleration features to include "CTAG" to indicate
    that they only support CTAGs. Follow up patches will introduce 802.1ad
    server provider tagging (STAGs) and require the distinction for hardware not
    supporting acclerating both.

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

    Patrick McHardy
     

14 Feb, 2013

1 commit


30 Jan, 2013

1 commit

  • Instead of jumping aroung bugs that are easily fixed just don't let them in:
    affected drivers should be either fixed or have NETIF_F_HW_VLAN_FILTER
    removed from advertised features.

    Quick grep in drivers/net shows two drivers that have NETIF_F_HW_VLAN_FILTER
    but not ndo_vlan_rx_add/kill_vid(), but those are false-positives (features
    are commented out).

    OTOH two drivers have ndo_vlan_rx_add/kill_vid() implemented but don't
    advertise NETIF_F_HW_VLAN_FILTER. Those are:

    +ethernet/cisco/enic/enic_main.c
    +ethernet/qlogic/qlcnic/qlcnic_main.c

    Signed-off-by: Michał Mirosław
    Signed-off-by: David S. Miller

    Michał Mirosław
     

05 Jan, 2013

1 commit


17 Oct, 2012

1 commit


09 Oct, 2012

1 commit

  • 6a32e4f9dd9219261f8856f817e6655114cfec2f made the vlan code skip marking
    vlan-tagged frames for not locally configured vlans as PACKET_OTHERHOST if
    there was an rx_handler, as the rx_handler could cause the frame to be received
    on a different (virtual) vlan-capable interface where that vlan might be
    configured.

    As rx_handlers do not necessarily return RX_HANDLER_ANOTHER, this could cause
    frames for unknown vlans to be delivered to the protocol stack as if they had
    been received untagged.

    For example, if an ipv6 router advertisement that's tagged for a locally not
    configured vlan is received on an interface with macvlan interfaces attached,
    macvlan's rx_handler returns RX_HANDLER_PASS after delivering the frame to the
    macvlan interfaces, which caused it to be passed to the protocol stack, leading
    to ipv6 addresses for the announced prefix being configured even though those
    are completely unusable on the underlying interface.

    The fix moves marking as PACKET_OTHERHOST after the rx_handler so the
    rx_handler, if there is one, sees the frame unchanged, but afterwards,
    before the frame is delivered to the protocol stack, it gets marked whether
    there is an rx_handler or not.

    Signed-off-by: Florian Zumbiehl
    Signed-off-by: David S. Miller

    Florian Zumbiehl
     

03 Oct, 2012

1 commit


25 Aug, 2012

1 commit


10 May, 2012

1 commit

  • Use the new bool function ether_addr_equal to add
    some clarity and reduce the likelihood for misuse
    of compare_ether_addr for sorting.

    Done via cocci script:

    $ cat compare_ether_addr.cocci
    @@
    expression a,b;
    @@
    - !compare_ether_addr(a, b)
    + ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - compare_ether_addr(a, b)
    + !ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - !ether_addr_equal(a, b) == 0
    + ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - !ether_addr_equal(a, b) != 0
    + !ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - ether_addr_equal(a, b) == 0
    + !ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - ether_addr_equal(a, b) != 0
    + ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - !!ether_addr_equal(a, b)
    + ether_addr_equal(a, b)

    Signed-off-by: Joe Perches
    Signed-off-by: David S. Miller

    Joe Perches
     

14 Dec, 2011

1 commit

  • The original code generates a Sparse warning:
    net/8021q/vlan_core.c:336:9:
    error: incompatible types in comparison expression (different address spaces)

    It's ok to dereference __rcu pointers here because we are holding the
    RTNL lock. I've added some calls to rtnl_dereference() to silence the
    warning.

    Signed-off-by: Dan Carpenter
    Acked-by: Eric Dumazet
    Acked-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Dan Carpenter
     

09 Dec, 2011

4 commits


04 Dec, 2011

1 commit


07 Nov, 2011

1 commit

  • * 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: (230 commits)
    Revert "tracing: Include module.h in define_trace.h"
    irq: don't put module.h into irq.h for tracking irqgen modules.
    bluetooth: macroize two small inlines to avoid module.h
    ip_vs.h: fix implicit use of module_get/module_put from module.h
    nf_conntrack.h: fix up fallout from implicit moduleparam.h presence
    include: replace linux/module.h with "struct module" wherever possible
    include: convert various register fcns to macros to avoid include chaining
    crypto.h: remove unused crypto_tfm_alg_modname() inline
    uwb.h: fix implicit use of asm/page.h for PAGE_SIZE
    pm_runtime.h: explicitly requires notifier.h
    linux/dmaengine.h: fix implicit use of bitmap.h and asm/page.h
    miscdevice.h: fix up implicit use of lists and types
    stop_machine.h: fix implicit use of smp.h for smp_processor_id
    of: fix implicit use of errno.h in include/linux/of.h
    of_platform.h: delete needless include
    acpi: remove module.h include from platform/aclinux.h
    miscdevice.h: delete unnecessary inclusion of module.h
    device_cgroup.h: delete needless include
    net: sch_generic remove redundant use of
    net: inet_timewait_sock doesnt need
    ...

    Fix up trivial conflicts (other header files, and removal of the ab3550 mfd driver) in
    - drivers/media/dvb/frontends/dibx000_common.c
    - drivers/media/video/{mt9m111.c,ov6650.c}
    - drivers/mfd/ab3550-core.c
    - include/linux/dmaengine.h

    Linus Torvalds
     

01 Nov, 2011

1 commit


30 Oct, 2011

1 commit

  • commit 2425717b27eb (net: allow vlan traffic to be received under bond)
    broke ARP processing on vlan on top of bonding.

    +-------+
    eth0 --| bond0 |---bond0.103
    eth1 --| |
    +-------+

    52870.115435: skb_gro_reset_offset
    Reviewed-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Eric Dumazet
     

19 Aug, 2011

1 commit

  • It's after all necessary to do reset headers here. The reason is we
    cannot depend that it gets reseted in __netif_receive_skb once skb is
    reinjected. For incoming vlanids without vlan_dev, vlan_do_receive()
    returns false with skb != NULL and __netif_reveive_skb continues, skb is
    not reinjected.

    This might be good material for 3.0-stable as well

    Reported-by: Mike Auty
    Signed-off-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Jiri Pirko
     

22 Jul, 2011

2 commits