14 Apr, 2017

2 commits

  • This is an add-on to the previous patch that passes the extended ACK
    structure where it's already available by existing genl_info or extack
    function arguments.

    This was done with this spatch (with some manual adjustment of
    indentation):

    @@
    expression A, B, C, D, E;
    identifier fn, info;
    @@
    fn(..., struct genl_info *info, ...) {
    ...
    -nlmsg_parse(A, B, C, D, E, NULL)
    +nlmsg_parse(A, B, C, D, E, info->extack)
    ...
    }

    @@
    expression A, B, C, D, E;
    identifier fn, info;
    @@
    fn(..., struct genl_info *info, ...) {
    extack)
    ...>
    }

    @@
    expression A, B, C, D, E;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {

    }

    @@
    expression A, B, C, D, E;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {

    }

    @@
    expression A, B, C, D, E;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {
    ...
    -nlmsg_parse(A, B, C, D, E, NULL)
    +nlmsg_parse(A, B, C, D, E, extack)
    ...
    }

    @@
    expression A, B, C, D;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {

    }

    @@
    expression A, B, C, D;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {

    }

    @@
    expression A, B, C, D;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {

    }

    @@
    expression A, B, C;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {

    }

    Signed-off-by: Johannes Berg
    Reviewed-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Johannes Berg
     
  • Pass the new extended ACK reporting struct to all of the generic
    netlink parsing functions. For now, pass NULL in almost all callers
    (except for some in the core.)

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

    Johannes Berg
     

28 Feb, 2017

1 commit

  • Now that %z is standartised in C99 there is no reason to support %Z.
    Unlike %L it doesn't even make format strings smaller.

    Use BUILD_BUG_ON in a couple ATM drivers.

    In case anyone didn't notice lib/vsprintf.o is about half of SLUB which
    is in my opinion is quite an achievement. Hopefully this patch inspires
    someone else to trim vsprintf.c more.

    Link: http://lkml.kernel.org/r/20170103230126.GA30170@avx2
    Signed-off-by: Alexey Dobriyan
    Cc: Andy Shevchenko
    Cc: Rasmus Villemoes
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

16 Dec, 2016

2 commits

  • That's the default now, no need for makefiles to set it.

    Signed-off-by: Michael S. Tsirkin
    Acked-by: Kalle Valo
    Acked-by: Marcel Holtmann
    Acked-by: Marc Kleine-Budde
    Acked-by: Greg Kroah-Hartman
    Acked-by: Arend van Spriel

    Michael S. Tsirkin
     
  • __bitwise__ used to mean "yes, please enable sparse checks
    unconditionally", but now that we dropped __CHECK_ENDIAN__
    __bitwise is exactly the same.
    There aren't many users, replace it by __bitwise everywhere.

    Signed-off-by: Michael S. Tsirkin
    Acked-by: Greg Kroah-Hartman
    Acked-by: Stefan Schmidt
    Acked-by: Krzysztof Kozlowski
    Akced-by: Lee Duncan

    Michael S. Tsirkin
     

30 Nov, 2016

1 commit

  • I've observed a NULL pointer dereference in ieee802154_del_iface() during
    netlink fuzzing. It's the ->wpan_phy dereference here:

    phy = dev->ieee802154_ptr->wpan_phy;

    My bet is that we're not checking that this is an IEEE802154 interface,
    so let's do what ieee802154_nl_get_dev() is doing. (Maybe we should even
    be calling this directly?)

    Cc: Lennert Buytenhek
    Cc: Alexander Aring
    Cc: Marcel Holtmann
    Cc: Dmitry Eremin-Solenikov
    Cc: Sergey Lapin
    Signed-off-by: Vegard Nossum
    Acked-by: Alexander Aring
    Signed-off-by: Stefan Schmidt

    vegard.nossum@oracle.com
     

28 Oct, 2016

4 commits

  • Now genl_register_family() is the only thing (other than the
    users themselves, perhaps, but I didn't find any doing that)
    writing to the family struct.

    In all families that I found, genl_register_family() is only
    called from __init functions (some indirectly, in which case
    I've add __init annotations to clarifly things), so all can
    actually be marked __ro_after_init.

    This protects the data structure from accidental corruption.

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

    Johannes Berg
     
  • Instead of providing macros/inline functions to initialize
    the families, make all users initialize them statically and
    get rid of the macros.

    This reduces the kernel code size by about 1.6k on x86-64
    (with allyesconfig).

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

    Johannes Berg
     
  • Static family IDs have never really been used, the only
    use case was the workaround I introduced for those users
    that assumed their family ID was also their multicast
    group ID.

    Additionally, because static family IDs would never be
    reserved by the generic netlink code, using a relatively
    low ID would only work for built-in families that can be
    registered immediately after generic netlink is started,
    which is basically only the control family (apart from
    the workaround code, which I also had to add code for so
    it would reserve those IDs)

    Thus, anything other than GENL_ID_GENERATE is flawed and
    luckily not used except in the cases I mentioned. Move
    those workarounds into a few lines of code, and then get
    rid of GENL_ID_GENERATE entirely, making it more robust.

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

    Johannes Berg
     
  • This helper function allows family implementations to access
    their family's attrbuf. This gets rid of the attrbuf usage
    in families, and also adds locking validation, since it's not
    valid to use the attrbuf with parallel_ops or outside of the
    dumpit callback.

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

    Johannes Berg
     

08 Jul, 2016

3 commits

  • The RIOT-OS stack does send intra-pan frames but don't set the intra pan
    flag inside the mac header. It seems this is valid frame addressing but
    inefficient. Anyway this patch adds a new function for intra pan
    addressing, doesn't matter if intra pan flag or source and destination
    are the same. The newly introduction function will be used to check on
    intra pan addressing for 6lowpan.

    Signed-off-by: Alexander Aring
    Signed-off-by: Marcel Holtmann

    Alexander Aring
     
  • This patch reverts commit f9d1ce8f81eb ("ieee802154: fix netns settings").
    The lowpan interface need to be created inside the net namespace where
    the wpan interface is available. The wpan namespace can be changed only
    by nl802154 before. Without this patch it's not possible to create a
    lowpan interface for a wpan interface which isn't inside init_net
    namespace.

    Cc: Nicolas Dichtel
    Reviewed-by: Stefan Schmidt
    Signed-off-by: Alexander Aring
    Signed-off-by: Marcel Holtmann

    Alexander Aring
     
  • This patch adds netns support for 802.15.4 subsystem. Most parts are
    copy&pasted from wireless subsystem, it has the identically userspace
    API.

    Cc: Nicolas Dichtel
    Reviewed-by: Stefan Schmidt
    Signed-off-by: Alexander Aring
    Signed-off-by: Marcel Holtmann

    Alexander Aring
     

06 Jul, 2016

1 commit


16 Jun, 2016

2 commits

  • This patch adds necessary handling for use the short address for
    802.15.4 6lowpan. It contains support for IPHC address compression
    and new matching algorithmn to decide which link layer address will be
    used for 802.15.4 frame.

    Reviewed-by: Stefan Schmidt
    Signed-off-by: Alexander Aring
    Signed-off-by: David S. Miller

    Alexander Aring
     
  • This patch will introduce a 6lowpan neighbour private data. Like the
    interface private data we handle private data for generic 6lowpan and
    for link-layer specific 6lowpan.

    The current first use case if to save the short address for a 802.15.4
    6lowpan neighbour.

    Cc: David S. Miller
    Reviewed-by: Stefan Schmidt
    Acked-by: YOSHIFUJI Hideaki
    Signed-off-by: Alexander Aring
    Signed-off-by: David S. Miller

    Alexander Aring
     

10 Jun, 2016

1 commit


08 Jun, 2016

1 commit

  • Instead of using a single bit (__QDISC___STATE_RUNNING)
    in sch->__state, use a seqcount.

    This adds lockdep support, but more importantly it will allow us
    to sample qdisc/class statistics without having to grab qdisc root lock.

    Signed-off-by: Eric Dumazet
    Cc: Cong Wang
    Cc: Jamal Hadi Salim
    Signed-off-by: David S. Miller

    Eric Dumazet
     

30 May, 2016

1 commit


27 Apr, 2016

1 commit

  • …etooth/bluetooth-next

    Johan Hedberg says:

    ====================
    pull request: bluetooth-next 2016-04-26

    Here's another set of Bluetooth & 802.15.4 patches for the 4.7 kernel:

    - Cleanups & refactoring of ieee802154 & 6lowpan code
    - Security related additions to ieee802154 and mrf24j40 driver
    - Memory corruption fix to Bluetooth 6lowpan code
    - Race condition fix in vhci driver
    - Enhancements to the atusb 802.15.4 driver

    Please let me know if there are any issues pulling. Thanks.
    ====================

    Signed-off-by: David S. Miller <davem@davemloft.net>

    David S. Miller
     

26 Apr, 2016

1 commit


24 Apr, 2016

1 commit


13 Apr, 2016

4 commits

  • This patch moves the 802.15.4 link layer specific structures to generic
    6lowpan. This is necessary for special 802.15.4 6lowpan handling in
    6lowpan generic layer.

    Reviewed-by: Stefan Schmidt
    Signed-off-by: Alexander Aring
    Acked-by: Jukka Rissanen
    Signed-off-by: Marcel Holtmann

    Alexander Aring
     
  • This patch changes the naming for interface private data for lowpan
    intefaces. The current private data scheme is:

    -------------------------------------------------
    | 6LoWPAN Generic | LinkLayer 6LoWPAN |
    -------------------------------------------------

    the current naming schemes are:

    - 6LoWPAN Generic:
    - lowpan_priv
    - LinkLayer 6LoWPAN:
    - BTLE
    - lowpan_dev
    - 802.15.4:
    - lowpan_dev_info

    the new naming scheme with this patch will be:

    - 6LoWPAN Generic:
    - lowpan_dev
    - LinkLayer 6LoWPAN:
    - BTLE
    - lowpan_btle_dev
    - 802.15.4:
    - lowpan_802154_dev

    Signed-off-by: Alexander Aring
    Reviewed-by: Stefan Schmidt
    Acked-by: Jukka Rissanen
    Signed-off-by: Marcel Holtmann

    Alexander Aring
     
  • The short address is unique in combination with the panid. This patch
    will add the panid for generating an ieee802154 address hash.

    Reviewed-by: Stefan Schmidt
    Signed-off-by: Alexander Aring
    Acked-by: Jukka Rissanen
    Signed-off-by: Marcel Holtmann

    Alexander Aring
     
  • The generation of autoconfigured IPv6 link-local addresses starts with a
    notification on interface up.

    To handle autoconfiguration according to RFC 4944 requires pan id and
    short address to generate an autoconfigured link-local address. This
    patch will avoid changing of these link-layer address configuration
    while lowpan interface is up.

    Reviewed-by: Stefan Schmidt
    Signed-off-by: Alexander Aring
    Acked-by: Jukka Rissanen
    Signed-off-by: Marcel Holtmann

    Alexander Aring
     

24 Feb, 2016

1 commit


11 Feb, 2016

1 commit

  • In order to support fast reuseport lookups in TCP, the hash function
    defined in struct proto must be capable of returning an error code.
    This patch changes the function signature of all related hash functions
    to return an integer and handles or propagates this return value at
    all call sites.

    Signed-off-by: Craig Gallek
    Signed-off-by: David S. Miller

    Craig Gallek
     

06 Jan, 2016

1 commit


10 Dec, 2015

1 commit

  • This patch introduces register and unregister functionality for lowpan
    interfaces. While register a lowpan interface there are several things
    which need to be initialize by the 6lowpan subsystem. Upcoming
    functionality need to register/unregister per interface components e.g.
    debugfs entry.

    Reviewed-by: Stefan Schmidt
    Signed-off-by: Alexander Aring
    Signed-off-by: Marcel Holtmann

    Alexander Aring
     

03 Nov, 2015

1 commit

  • This patch fixes following problems :

    1) percpu_counter_init() can return an error, therefore
    init_frag_mem_limit() must propagate this error so that
    inet_frags_init_net() can do the same up to its callers.

    2) If ip[46]_frags_ns_ctl_register() fail, we must unwind
    properly and free the percpu_counter.

    Without this fix, we leave freed object in percpu_counters
    global list (if CONFIG_HOTPLUG_CPU) leading to crashes.

    This bug was detected by KASAN and syzkaller tool
    (http://github.com/google/syzkaller)

    Fixes: 6d7b857d541e ("net: use lib/percpu_counter API for fragmentation mem accounting")
    Signed-off-by: Eric Dumazet
    Reported-by: Dmitry Vyukov
    Cc: Hannes Frederic Sowa
    Cc: Jesper Dangaard Brouer
    Acked-by: Hannes Frederic Sowa
    Signed-off-by: David S. Miller

    Eric Dumazet
     

22 Oct, 2015

1 commit

  • Looking at current situation of memory management in 6lowpan receive
    function I detected some invalid handling. After calling
    lowpan_invoke_rx_handlers we will do a kfree_skb and then NET_RX_DROP on
    error handling. We don't do this before, also on
    skb_share_check/skb_unshare which might manipulate the reference
    counters.

    After running some 'grep -r "dev_add_pack" net/' to look how others
    packet-layer receive callbacks works I detected that every subsystem do
    a kfree_skb, then NET_RX_DROP without calling skb functions which
    might manipulate the skb reference counters. This is the reason why we
    should do the same here like all others subsystems. I didn't find any
    documentation how the packet-layer receive callbacks handle NET_RX_DROP
    return values either.

    This patch will add a kfree_skb, then NET_RX_DROP handling for the
    "trivial checks", in case of skb_share_check/skb_unshare the kfree_skb
    call will be done inside these functions.

    Signed-off-by: Alexander Aring
    Signed-off-by: Marcel Holtmann

    Alexander Aring
     

21 Oct, 2015

4 commits

  • This macro is used at 802.15.4 6LoWPAN only and can be replaced by
    memcmp with the interface broadcast address.

    Signed-off-by: Alexander Aring
    Signed-off-by: Marcel Holtmann

    Alexander Aring
     
  • This patch removes the IPHC related defines for doing bit manipulation
    from global 6lowpan header to the iphc file which should the only one
    implementation which use these defines.

    Also move next header compression defines to their nhc implementation.

    Signed-off-by: Alexander Aring
    Signed-off-by: Marcel Holtmann

    Alexander Aring
     
  • This patch changes the lowpan_header_decompress function by removing
    inklayer related information from parameters. This is currently for
    supporting short and extended address for iphc handling in 802154.
    We don't support short address handling anyway right now, but there
    exists already code for handling short addresses in
    lowpan_header_decompress.

    The address parameters are also changed to a void pointer, so 6LoWPAN
    linklayer specific code can put complex structures as these parameters
    and cast it again inside the generic code by evaluating linklayer type
    before. The order is also changed by destination address at first and
    then source address, which is the same like all others functions where
    destination is always the first, memcpy, dev_hard_header,
    lowpan_header_compress, etc.

    This patch also moves the fetching of iphc values from 6LoWPAN linklayer
    specific code into the generic branch.

    Signed-off-by: Alexander Aring
    Acked-by: Jukka Rissanen
    Signed-off-by: Marcel Holtmann

    Alexander Aring
     
  • This patch changes the lowpan_header_compress function by removing
    unused parameters like "len" and drop static value parameters of
    protocol type. Instead we really check the protocol type inside inside
    the skb structure. Also we drop the use of IEEE802154_ADDR_LEN which is
    link-layer specific. Instead we using EUI64_ADDR_LEN which should always
    the default case for now.

    Signed-off-by: Alexander Aring
    Acked-by: Jukka Rissanen
    Signed-off-by: Marcel Holtmann

    Alexander Aring
     

08 Oct, 2015

1 commit

  • This patch moves values for all lowpan interface to the shared
    implementation of 6lowpan. This patch also quietly fixes the forgotten
    IFF_NO_QUEUE flag for the bluetooth 6LoWPAN interface. An identically
    commit is 4afbc0d ("net: 6lowpan: convert to using IFF_NO_QUEUE") which
    wasn't changed for bluetooth 6lowpan.

    All 6lowpan interfaces should be virtual with IFF_NO_QUEUE, using EUI64
    address length, the mtu size is 1280 (IPV6_MIN_MTU) and the netdev type
    is ARPHRD_6LOWPAN.

    Signed-off-by: Alexander Aring
    Acked-by: Jukka Rissanen
    Signed-off-by: Marcel Holtmann

    Alexander Aring
     

03 Oct, 2015

1 commit


01 Oct, 2015

1 commit

  • This reverts commit 9abc378c66e3d6f437eed77c1c534cbc183523f7
    ("ieee802154: 6lowpan: change datagram var types").

    The reason is that I forgot the IPv6 fragmentation here. Our MTU of
    lowpan interface is 1280 and skb->len should not above of that. If we
    reach a payload above 1280 in IPv6 header then we have a IPv6
    fragmentation above 802.15.4 6LoWPAN fragmentation. The type "u16" was
    fine, instead I added now a WARN_ON_ONCE if skb->len is above MTU which
    should never happen otherwise IPv6 on minimum MTU size is broken.

    Signed-off-by: Alexander Aring
    Signed-off-by: Marcel Holtmann

    Alexander Aring
     

30 Sep, 2015

1 commit

  • This patch adds support for increment transmit and receive stats. The
    meaning of these stats are IPv6 based, which shows the stats after
    running the 6lowpan adaptation layer (uncompression/compression,
    fragmentation handling) on receive and before the adaptation layer
    when transmit.

    Signed-off-by: Alexander Aring
    Signed-off-by: Marcel Holtmann

    Alexander Aring