From: "YOSHIFUJI Hideaki/吉藤英明" <hideaki.yoshifuji@miraclelinux.com>
To: linux-wpan@vger.kernel.org, linux-bluetooth@vger.kernel.org,
netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>,
Alexander Aring <alex.aring@gmail.com>,
hideaki.yoshifuji@miraclelinux.com, kernel@pengutronix.de,
mcr@sandelman.ca, lukasz.duda@nordicsemi.no,
martin.gergeleit@hs-rm.de,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
James Morris <jmorris@namei.org>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
Patrick McHardy <kaber@trash.net>
Subject: Re: [RFCv3 bluetooth-next 3/4] ipv6: add ipv6_addr_prefix_copy
Date: Tue, 1 Dec 2015 20:17:19 +0900 [thread overview]
Message-ID: <565D81BF.3080608@miraclelinux.com> (raw)
In-Reply-To: <1448967386.3315997.454536553.3B344491@webmail.messagingengine.com>
Hannes Frederic Sowa wrote:
>
>
> On Sun, Nov 29, 2015, at 12:34, Alexander Aring wrote:
>> This patch adds a static inline function ipv6_addr_prefix_copy which
>> copies a ipv6 address prefix(argument pfx) into the ipv6 address prefix.
>> The prefix len is given by plen as bits. This function mainly based on
>> ipv6_addr_prefix which copies one address prefix from address into a new
>> ipv6 address destination and zero all other address bits.
>>
>> The difference is that ipv6_addr_prefix_copy don't get a prefix from an
>> ipv6 address, it sets a prefix to an ipv6 address with keeping other
>> address bits. The use case is for context based address compression
>> inside 6LoWPAN IPHC header which keeping ipv6 prefixes inside a context
>> table to lookup address-bits without sending them.
>>
>> Cc: David S. Miller <davem@davemloft.net>
>> Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
>> Cc: James Morris <jmorris@namei.org>
>> Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
>> Cc: Patrick McHardy <kaber@trash.net>
>> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
>> ---
>> include/net/ipv6.h | 15 +++++++++++++++
>> 1 file changed, 15 insertions(+)
>>
>> diff --git a/include/net/ipv6.h b/include/net/ipv6.h
>> index e1a10b0..cd3881e6 100644
>> --- a/include/net/ipv6.h
>> +++ b/include/net/ipv6.h
>> @@ -382,6 +382,21 @@ static inline void ipv6_addr_prefix(struct in6_addr
>> *pfx,
>> pfx->s6_addr[o] = addr->s6_addr[o] & (0xff00 >> b);
>> }
>>
>> +static inline void ipv6_addr_prefix_copy(struct in6_addr *addr,
>> + const struct in6_addr *pfx,
>> + int plen)
>> +{
>> + /* caller must guarantee 0 <= plen <= 128 */
>> + int o = plen >> 3,
>> + b = plen & 0x7;
>> +
>> + memcpy(addr->s6_addr, pfx, o);
>> + if (b != 0) {
>> + addr->s6_addr[o] &= ~(0xff00 >> b);
>> + addr->s6_addr[o] |= (pfx->s6_addr[o] & (0xff00 >> b));
>> + }
>> +}
>> +
>
> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
吉藤英明 <hideaki.yoshifuji@miraclelinux.com>
ミラクル・リナックス株式会社 技術本部 サポート部
next prev parent reply other threads:[~2015-12-01 11:17 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-29 11:34 [RFCv3 bluetooth-next 0/4] 6lowpan: debugfs and stateful compression support Alexander Aring
2015-11-29 11:34 ` Alexander Aring
2015-11-29 11:34 ` [RFCv3 bluetooth-next 1/4] 6lowpan: add lowpan dev register helpers Alexander Aring
2015-11-29 11:34 ` Alexander Aring
2015-12-01 20:38 ` Stefan Schmidt
2015-11-29 11:34 ` [RFCv3 bluetooth-next 2/4] 6lowpan: add debugfs support Alexander Aring
2015-11-29 11:34 ` Alexander Aring
2015-12-01 20:50 ` Stefan Schmidt
2015-12-01 20:50 ` Stefan Schmidt
2015-11-29 11:34 ` [RFCv3 bluetooth-next 3/4] ipv6: add ipv6_addr_prefix_copy Alexander Aring
2015-11-29 11:34 ` Alexander Aring
2015-12-01 10:56 ` Hannes Frederic Sowa
2015-12-01 10:56 ` Hannes Frederic Sowa
2015-12-01 11:17 ` YOSHIFUJI Hideaki/吉藤英明 [this message]
2015-12-01 11:38 ` Stefan Schmidt
2015-12-01 11:38 ` Stefan Schmidt
2015-12-01 11:51 ` Duda, Lukasz
2015-11-29 11:34 ` [RFCv3 bluetooth-next 4/4] 6lowpan: iphc: add support for stateful compression Alexander Aring
2015-11-29 11:34 ` Alexander Aring
2015-12-02 14:18 ` Stefan Schmidt
2015-12-03 14:22 ` Alexander Aring
2015-12-03 14:22 ` Alexander Aring
2015-12-04 12:13 ` Stefan Schmidt
2015-12-04 12:13 ` Stefan Schmidt
2015-12-11 17:05 ` Alexander Aring
2015-12-11 17:13 ` Alexander Aring
2015-12-11 17:13 ` Alexander Aring
2015-12-11 19:11 ` Stefan Schmidt
2015-12-11 19:49 ` Alexander Aring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=565D81BF.3080608@miraclelinux.com \
--to=hideaki.yoshifuji@miraclelinux.com \
--cc=alex.aring@gmail.com \
--cc=davem@davemloft.net \
--cc=hannes@stressinduktion.org \
--cc=jmorris@namei.org \
--cc=kaber@trash.net \
--cc=kernel@pengutronix.de \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-wpan@vger.kernel.org \
--cc=lukasz.duda@nordicsemi.no \
--cc=martin.gergeleit@hs-rm.de \
--cc=mcr@sandelman.ca \
--cc=netdev@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.