11 Mar, 2016

1 commit


26 Feb, 2016

1 commit

  • This patch fixes the return value in a case which should never occur.
    Instead returning "-EINVAL" we return LOWPAN_IPHC_DAM_00 which is
    invalid on context based addresses. Also change the WARN_ON_ONCE to
    WARN_ONCE which was suggested by Dan Carpenter.

    Reported-by: Dan Carpenter
    Signed-off-by: Alexander Aring
    Signed-off-by: Marcel Holtmann

    Alexander Aring
     

24 Feb, 2016

3 commits

  • Bool variable 'fail' is always non-negative, it indicates an error if it
    is true.

    The problem has been detected using coccinelle script
    scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci

    Signed-off-by: Andrzej Hajda
    Acked-by: Alexander Aring
    Signed-off-by: Marcel Holtmann

    Andrzej Hajda
     
  • In case of multicast address we need to set always the LOWPAN_IPHC_M bit
    and if a destination context identifier was found for a multicast
    address then we need to set the LOWPAN_IPHC_DAC as well.

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

    Alexander Aring
     
  • This patch introduce support for IPHC stateful address compression. It
    will offer the context table via one debugfs entry.
    This debugfs has and directory for each cid entry for the context table.
    Inside each cid directory there exists the following files:

    - "active": If the entry is added or deleted. The context table is
    original a list implementation, this flag will indicate if the
    context is part of list or not.
    - "prefix": The ipv6 prefix.
    - "prefix_length": The prefix length for the prefix.
    - "compression": The compression flag according RFC6775.

    This part should be moved into sysfs after some testing time.

    Also the debugfs entry contains a "show" file which is a pretty-printout
    for the current context table information.

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

    Alexander Aring
     

21 Oct, 2015

9 commits

  • This patch moves the mcast compression algorithmn to an own function
    like all other compression/decompression methods in iphc.

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

    Alexander Aring
     
  • This patch reworks the handling of compression/decompression of traffic
    class and flow label handling. The current method is hard to understand,
    also doesn't checks if we can read the buffer from skb length.

    I tried to put the shifting operations into static inline functions and
    comment each steps which I did there to make it hopefully somewhat more
    readable. The big mess to deal with that is the that the ipv6 header
    bring the order "DSCP + ECN" but iphc uses "ECN + DSCP". Additional the
    DCSP + ECN bits are splitted in ipv6_hdr inside the priority and
    flow_lbl[0] fields.

    I tested these compressions by using fakelb 802.15.4 driver and
    manipulate the tc and flow label fields manually in function
    "__ip6_local_out" before the skb will be send to lower layers. Then I
    looked up the tc and flow label fields in wireshark on a wpan and lowpan
    interface.

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

    Alexander Aring
     
  • This patch has the main goal to delete shift operations. Instead we
    doing masks and equals afterwards. E.g. for the SAM evaluation we
    masking only the SAM value which fits in iphc1 byte, then comparing with
    all possible SAM values over a switch case statement. We will not
    shifting the SAM value to somewhat readable anymore.
    Additional this patch slighty change the naming style like RFC 6282,
    e.g. TTL to HLIM and we will drop an errno now if CID flag is set,
    because we don't support it.

    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 moves the iphc setting of next header commpression bit inside
    iphc functionality. Setting of IPHC bits should be happen at iphc.c file
    only.

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

    Alexander Aring
     
  • This patch removes the lowpan_fetch_skb_u8 function for getting the iphc
    bytes. Instead we using the generic which has a len parameter to tell
    the amount of bytes to fetch.

    Signed-off-by: Alexander Aring
    Acked-by: Jukka Rissanen
    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
     
  • This patch introduces the LOWPAN_IPHC_MAX_HC_BUF_LEN define which
    represent the worst-case supported IPHC buffer length. It's used to
    allocate the stack buffer space for creating the IPHC header.

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

    Alexander Aring
     

17 Sep, 2015

1 commit

  • This patch complete reworks the evaluation of 6lowpan dispatch value by
    introducing a receive handler mechanism for each dispatch value.

    A list of changes:

    - Doing uncompression on-the-fly when FRAG1 is received, this require
    some special handling for 802.15.4 lltype in generic 6lowpan branch
    for setting the payload length correct.
    - Fix dispatch mask for fragmentation.
    - Add IPv6 dispatch evaluation for FRAG1.
    - Add skb_unshare for dispatch which might manipulate the skb data
    buffer.

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

    Alexander Aring
     

12 Aug, 2015

1 commit

  • This patch moves module_init of 6lowpan module into core functionality
    of 6lowpan module. To load the ipv6 module at probing of the 6lowpan
    module should be core functionality. Loading next header compression
    modules is iphc specific. Nevertheless we only support IPHC for the
    generic 6LoWPAN branch right now so we can put it into the core
    functionality. If possible new compression formats are introduced nhc
    should load only when iphc is build.

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

    Alexander Aring
     

11 Aug, 2015

1 commit

  • The lowpan_fetch_skb function is used to fetch the first byte,
    which also increments the data pointer in skb structure,
    making subsequent array lookup of byte 0 actually being byte 1.

    To decompress the first byte of the Flow Label when the TF flag is
    set to 0x01, the second half of the first byte is needed.

    The patch fixes the extraction of the Flow Label field.

    Acked-by: Jukka Rissanen
    Signed-off-by: Lukasz Duda
    Signed-off-by: Glenn Ruben Bakke
    Signed-off-by: Alexander Aring
    Signed-off-by: Marcel Holtmann

    Lukasz Duda
     

23 Jul, 2015

1 commit

  • The iphc module depends on CONFIG_IPV6, because it's not very useful to
    build the module without IPv6 support. Recently an user reported about
    issues for setting an IPv6 address to a 6LoWPAN interface. The issues
    was solved by modprobe the ipv6 module before. To avoid such user issues
    we try to request the ipv6 module when the 6LoWPAN module is loaded.

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

    Alexander Aring
     

15 Feb, 2015

2 commits

  • This patch adds other known rfc6282 compression formats to the nhc
    framework. These compression formats are known but not implemented yet.
    For now this is useful to printout a warning which compression format
    isn't supported.

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

    Alexander Aring
     
  • This patch move UDP header compression and uncompression into the
    generic 6LoWPAN nhc header compression layer. Moreover this patch
    activates the nhc layer compression in iphc compression and
    uncompression functions.

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

    Alexander Aring
     

05 Dec, 2014

1 commit


07 Nov, 2014

1 commit

  • Currently we ensure that the skb is freed on every error path in IPHC
    decompression which makes it easy to introduce skb leaks. By centralising
    the skb_free into the receive function it makes future decompression routines
    easier to maintain. It does come at the expense of ensuring that the skb
    passed into the decompression routine must not be copied.

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

    Martin Townsend
     

05 Nov, 2014

1 commit

  • If you use RAW sockets the transport header offset is not set by the
    ipv6 stack so when we get to the udp header compression it does not
    compress the right part of the packet.

    This patch adds a check for this scenario and sets the transport
    header offset.

    Signed-off-by: Simon Vincent
    Acked-by: Alexander Aring
    Signed-off-by: Marcel Holtmann

    Simon Vincent
     

27 Oct, 2014

2 commits


25 Oct, 2014

1 commit

  • Currently there are potentially 2 skb_copy_expand calls in IPHC
    decompression. This patch replaces this with one call to
    skb_cow which will check to see if there is enough headroom
    first to ensure it's only done if necessary and will handle
    alignment issues for cache.
    As skb_cow uses pskb_expand_head we ensure the skb isn't shared from
    bluetooth and ieee802.15.4 code that use the IPHC decompression.

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

    Martin Townsend
     

06 Aug, 2014

1 commit

  • …inville/wireless-next

    Conflicts:
    net/6lowpan/iphc.c

    Minor conflicts in iphc.c were changes overlapping with some
    style cleanups.

    John W. Linville says:

    ====================
    Please pull this last(?) batch of wireless change intended for the
    3.17 stream...

    For the NFC bits, Samuel says:

    "This is a rather quiet one, we have:

    - A new driver from ST Microelectronics for their NCI ST21NFCB,
    including device tree support.

    - p2p support for the ST21NFCA driver

    - A few fixes an enhancements for the NFC digital laye"

    For the Atheros bits, Kalle says:

    "Michal and Janusz did some important RX aggregation fixes, basically we
    were missing RX reordering altogether. The 10.1 firmware doesn't support
    Ad-Hoc mode and Michal fixed ath10k so that it doesn't advertise Ad-Hoc
    support with that firmware. Also he implemented a workaround for a KVM
    issue."

    For the Bluetooth bits, Gustavo and Johan say:

    "To quote Gustavo from his previous request:

    'Some last minute fixes for -next. We have a fix for a use after free in
    RFCOMM, another fix to an issue with ADV_DIRECT_IND and one for ADV_IND with
    auto-connection handling. Last, we added support for reading the codec and
    MWS setting for controllers that support these features.'

    Additionally there are fixes to LE scanning, an update to conform to the 4.1
    core specification as well as fixes for tracking the page scan state. All
    of these fixes are important for 3.17."

    And,

    "We've got:

    - 6lowpan fixes/cleanups
    - A couple crash fixes, one for the Marvell HCI driver and another in LE SMP.
    - Fix for an incorrect connected state check
    - Fix for the bondable requirement during pairing (an issue which had
    crept in because of using "pairable" when in fact the actual meaning
    was "bondable" (these have different meanings in Bluetooth)"

    Along with those are some late-breaking hardware support patches in
    brcmfmac and b43 as well as a stray ath9k patch.
    ====================

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

    David S. Miller
     

31 Jul, 2014

11 commits

  • CHECK: Alignment should match open parenthesis
    + if (((hdr->flow_lbl[0] & 0x0F) == 0) &&
    + (hdr->flow_lbl[1] == 0) && (hdr->flow_lbl[2] == 0)) {

    CHECK: Alignment should match open parenthesis
    + if ((hdr->priority == 0) &&
    + ((hdr->flow_lbl[0] & 0xF0) == 0)) {

    CHECK: Alignment should match open parenthesis
    + if ((hdr->priority == 0) &&
    + ((hdr->flow_lbl[0] & 0xF0) == 0)) {

    Signed-off-by: Marcel Holtmann
    Signed-off-by: Johan Hedberg

    Marcel Holtmann
     
  • CHECK: braces {} should be used on all arms of this statement
    + if ((iphc0 & 0x03) != LOWPAN_IPHC_TTL_I)
    [...]
    + else {
    [...]

    Signed-off-by: Marcel Holtmann
    Signed-off-by: Johan Hedberg

    Marcel Holtmann
     
  • WARNING: Missing a blank line after declarations
    + struct sk_buff *new;
    + if (uncompress_udp_header(skb, &uh))

    Signed-off-by: Marcel Holtmann
    Signed-off-by: Johan Hedberg

    Marcel Holtmann
     
  • This patch fixes all the issues with alignment matching of open
    parenthesis found by checkpatch.pl and makes them follow the
    network coding style now.

    CHECK: Alignment should match open parenthesis
    +static int uncompress_addr(struct sk_buff *skb,
    + struct in6_addr *ipaddr, const u8 address_mode,

    CHECK: Alignment should match open parenthesis
    +static int uncompress_context_based_src_addr(struct sk_buff *skb,
    + struct in6_addr *ipaddr,

    CHECK: Alignment should match open parenthesis
    +static int skb_deliver(struct sk_buff *skb, struct ipv6hdr *hdr,
    + struct net_device *dev, skb_delivery_cb deliver_skb)

    CHECK: Alignment should match open parenthesis
    + new = skb_copy_expand(skb, sizeof(struct ipv6hdr), skb_tailroom(skb),
    + GFP_ATOMIC);

    CHECK: Alignment should match open parenthesis
    + raw_dump_table(__func__, "raw skb data dump before receiving",
    + new->data, new->len);

    CHECK: Alignment should match open parenthesis
    +lowpan_uncompress_multicast_daddr(struct sk_buff *skb,
    + struct in6_addr *ipaddr,

    CHECK: Alignment should match open parenthesis
    + raw_dump_inline(NULL, "Reconstructed ipv6 multicast addr is",
    + ipaddr->s6_addr, 16);

    CHECK: Alignment should match open parenthesis
    +int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
    + const u8 *saddr, const u8 saddr_type, const u8 saddr_len,

    CHECK: Alignment should match open parenthesis
    + raw_dump_table(__func__, "raw skb data dump uncompressed",
    + skb->data, skb->len);

    CHECK: Alignment should match open parenthesis
    + err = uncompress_addr(skb, &hdr.saddr, tmp, saddr,
    + saddr_type, saddr_len);

    CHECK: Alignment should match open parenthesis
    + err = uncompress_addr(skb, &hdr.daddr, tmp, daddr,
    + daddr_type, daddr_len);

    CHECK: Alignment should match open parenthesis
    + pr_debug("dest: stateless compression mode %d dest %pI6c\n",
    + tmp, &hdr.daddr);

    CHECK: Alignment should match open parenthesis
    + raw_dump_table(__func__, "raw UDP header dump",
    + (u8 *)&uh, sizeof(uh));

    CHECK: Alignment should match open parenthesis
    + raw_dump_table(__func__, "raw header dump", (u8 *)&hdr,
    + sizeof(hdr));

    CHECK: Alignment should match open parenthesis
    +int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev,
    + unsigned short type, const void *_daddr,

    CHECK: Alignment should match open parenthesis
    + raw_dump_table(__func__, "raw skb network header dump",
    + skb_network_header(skb), sizeof(struct ipv6hdr));

    CHECK: Alignment should match open parenthesis
    + raw_dump_table(__func__,
    + "sending raw skb network uncompressed packet",

    CHECK: Alignment should match open parenthesis
    + if (((hdr->flow_lbl[0] & 0x0F) == 0) &&
    + (hdr->flow_lbl[1] == 0) && (hdr->flow_lbl[2] == 0)) {

    WARNING: quoted string split across lines
    + pr_debug("dest address unicast link-local %pI6c "
    + "iphc1 0x%02x\n", &hdr->daddr, iphc1);

    CHECK: Alignment should match open parenthesis
    + raw_dump_table(__func__, "raw skb data dump compressed",
    + skb->data, skb->len);

    Signed-off-by: Marcel Holtmann
    Signed-off-by: Johan Hedberg

    Marcel Holtmann
     
  • This patch fixes all the block comment issues found by checkpatch.pl and
    makes them match the network style now.

    WARNING: networking block comments don't use an empty /* line, use /* Comment...
    +/*
    + * Based on patches from Jon Smirl

    WARNING: networking block comments don't use an empty /* line, use /* Comment...
    +/*
    + * Uncompress address function for source and

    WARNING: networking block comments don't use an empty /* line, use /* Comment...
    +/*
    + * Uncompress address function for source context

    WARNING: networking block comments don't use an empty /* line, use /* Comment...
    + /*
    + * UDP lenght needs to be infered from the lower layers

    WARNING: networking block comments don't use an empty /* line, use /* Comment...
    + /*
    + * Traffic Class and FLow Label carried in-line

    WARNING: networking block comments don't use an empty /* line, use /* Comment...
    + /*
    + * Traffic class carried in-line

    WARNING: networking block comments don't use an empty /* line, use /* Comment...
    + /*
    + * Flow Label carried in-line

    WARNING: networking block comments don't use an empty /* line, use /* Comment...
    + /*
    + * replace the compressed UDP head by the uncompressed UDP

    WARNING: networking block comments don't use an empty /* line, use /* Comment...
    + /*
    + * As we copy some bit-length fields, in the IPHC encoding bytes,

    WARNING: networking block comments don't use an empty /* line, use /* Comment...
    + /*
    + * Traffic class, flow label

    WARNING: networking block comments don't use an empty /* line, use /* Comment...
    + /*
    + * Hop limit

    Signed-off-by: Marcel Holtmann
    Signed-off-by: Johan Hedberg

    Marcel Holtmann
     
  • This memory is placed on stack and can't be null so remove the check on
    null.

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

    Alexander Aring
     
  • This patch removes the own implementation to check of link-layer,
    broadcast and any address type and use the IPv6 api for that.

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

    Alexander Aring
     
  • This patch uses the lowpan_push_hc_data functions in several places
    where we can use it. The lowpan_push_hc_data was introduced in some
    previous patches.

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

    Alexander Aring
     
  • We introduced the lowpan_fetch_skb function in some previous patches for
    6lowpan to have a generic fetch function. This patch drops the old
    function and use the generic lowpan_fetch_skb one.

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

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

    Alexander Aring
     
  • The hc06_ptr pointer variable stands for header compression draft-06. We
    are mostly rfc complaint. This patch rename the variable to normal hc_ptr.

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

    Alexander Aring
     

29 Jul, 2014

1 commit

  • …inville/wireless-next

    John W. Linville says:

    ====================
    pull request: wireless-next 2014-07-25

    Please pull this batch of updates intended for the 3.17 stream!

    For the mac80211 bits, Johannes says:

    "We have a lot of TDLS patches, among them a fix that should make hwsim
    tests happy again. The rest, this time, is mostly small fixes."

    For the Bluetooth bits, Gustavo says:

    "Some more patches for 3.17. The most important change here is the move of
    the 6lowpan code to net/6lowpan. It has been agreed with Davem that this
    change will go through the bluetooth tree. The rest are mostly clean up and
    fixes."

    and,

    "Here follows some more patches for 3.17. These are mostly fixes to what
    we've sent to you before for next merge window."

    For the iwlwifi bits, Emmanuel says:

    "I have the usual amount of BT Coex stuff. Arik continues to work
    on TDLS and Ariej contributes a few things for HS2.0. I added a few
    more things to the firmware debugging infrastructure. Eran fixes a
    small bug - pretty normal content."

    And for the Atheros bits, Kalle says:

    "For ath6kl me and Jessica added support for ar6004 hw3.0, our latest
    version of ar6004.

    For ath10k Janusz added a printout so that it's easier to check what
    ath10k kconfig options are enabled. He also added a debugfs file to
    configure maximum amsdu and ampdu values. Also we had few fixes as
    usual."

    On top of that is the usual large batch of various driver updates --
    brcmfmac, mwifiex, the TI drivers, and wil6210 all get some action.
    Rafał has also been very busy with b43 and related updates.

    Also, I pulled the wireless tree into this in order to resolve a
    merge conflict...

    P.S. The change to fs/compat_ioctl.c reflects a name change in a
    Bluetooth header file...
    ====================

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

    David S. Miller
     

12 Jul, 2014

1 commit

  • This patch moves generic code which is used by bluetooth and ieee802154
    6lowpan to a new net/6lowpan directory. This directory contains generic
    6LoWPAN code which is shared between bluetooth and ieee802154 MAC-Layer.

    This is the IPHC - "IPv6 Header Compression" format at the moment. Which
    is described by RFC 6282 [0]. The BLTE 6LoWPAN draft describes that the
    IPHC is the same format like IEEE 802.15.4, see [1].

    Futuremore we can put more code into this directory which is shared
    between BLTE and IEEE 802.15.4 6LoWPAN like RFC 6775 or the routing
    protocol RPL RFC 6550.

    To avoid naming conflicts I renamed 6lowpan-y to ieee802154_6lowpan-y
    in net/ieee802154/Makefile.

    [0] http://tools.ietf.org/html/rfc6282
    [1] http://tools.ietf.org/html/draft-ietf-6lowpan-btle-12#section-3.2
    [2] http://tools.ietf.org/html/rfc6775
    [3] http://tools.ietf.org/html/rfc6550

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

    Alexander Aring