diff options
author | Tom Herbert <tom@herbertland.com> | 2016-04-23 21:46:55 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-04-26 08:25:22 +0300 |
commit | 351596aad54a7e07de63fde38496656514661b07 (patch) | |
tree | 215bc1012eddca60324250cb6d384a549babde50 /net/ipv6/ila/ila_common.c | |
parent | a843311d87b69540641d491b97b328309d3a28a1 (diff) | |
download | linux-351596aad54a7e07de63fde38496656514661b07.tar.xz |
ila: Add struct definitions and helpers
Add structures for identifiers, locators, and an ila address which
is composed of a locator and identifier and in6_addr can be cast to
it. This includes a three bit type field and enums for the types defined
in ILA I-D.
In ILA lwt don't allow user to set a translation for a non-ILA
address (type of identifier is zero meaning it is an IID). This also
requires that the destination prefix is at least 65 bytes (64
bit locator and first byte of identifier).
Signed-off-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ila/ila_common.c')
-rw-r--r-- | net/ipv6/ila/ila_common.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/net/ipv6/ila/ila_common.c b/net/ipv6/ila/ila_common.c index 30613050e4ca..c3078d0b64e1 100644 --- a/net/ipv6/ila/ila_common.c +++ b/net/ipv6/ila/ila_common.c @@ -15,17 +15,20 @@ static __wsum get_csum_diff(struct ipv6hdr *ip6h, struct ila_params *p) { - if (*(__be64 *)&ip6h->daddr == p->locator_match) + struct ila_addr *iaddr = ila_a2i(&ip6h->daddr); + + if (iaddr->loc.v64 == p->locator_match.v64) return p->csum_diff; else - return compute_csum_diff8((__be32 *)&ip6h->daddr, + return compute_csum_diff8((__be32 *)&iaddr->loc, (__be32 *)&p->locator); } -void update_ipv6_locator(struct sk_buff *skb, struct ila_params *p) +void ila_update_ipv6_locator(struct sk_buff *skb, struct ila_params *p) { __wsum diff; struct ipv6hdr *ip6h = ipv6_hdr(skb); + struct ila_addr *iaddr = ila_a2i(&ip6h->daddr); size_t nhoff = sizeof(struct ipv6hdr); /* First update checksum */ @@ -68,7 +71,7 @@ void update_ipv6_locator(struct sk_buff *skb, struct ila_params *p) } /* Now change destination address */ - *(__be64 *)&ip6h->daddr = p->locator; + iaddr->loc = p->locator; } static int __init ila_init(void) |