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>
This commit is contained in:
Tom Herbert
2016-04-23 11:46:55 -07:00
committed by David S. Miller
orang tua a843311d87
melakukan 351596aad5
4 mengubah file dengan 161 tambahan dan 82 penghapusan

Melihat File

@@ -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)