|
3 | 3 | * not configured or static. These functions are needed by GSO/GRO implementation. |
4 | 4 | */ |
5 | 5 | #include <linux/export.h> |
| 6 | +#include <net/ip.h> |
6 | 7 | #include <net/ipv6.h> |
7 | 8 | #include <net/ip6_fib.h> |
8 | 9 | #include <net/addrconf.h> |
9 | 10 | #include <net/secure_seq.h> |
10 | 11 |
|
| 12 | +/* This function exists only for tap drivers that must support broken |
| 13 | + * clients requesting UFO without specifying an IPv6 fragment ID. |
| 14 | + * |
| 15 | + * This is similar to ipv6_select_ident() but we use an independent hash |
| 16 | + * seed to limit information leakage. |
| 17 | + * |
| 18 | + * The network header must be set before calling this. |
| 19 | + */ |
| 20 | +void ipv6_proxy_select_ident(struct sk_buff *skb) |
| 21 | +{ |
| 22 | + static u32 ip6_proxy_idents_hashrnd __read_mostly; |
| 23 | + struct in6_addr buf[2]; |
| 24 | + struct in6_addr *addrs; |
| 25 | + u32 hash, id; |
| 26 | + |
| 27 | + addrs = skb_header_pointer(skb, |
| 28 | + skb_network_offset(skb) + |
| 29 | + offsetof(struct ipv6hdr, saddr), |
| 30 | + sizeof(buf), buf); |
| 31 | + if (!addrs) |
| 32 | + return; |
| 33 | + |
| 34 | + net_get_random_once(&ip6_proxy_idents_hashrnd, |
| 35 | + sizeof(ip6_proxy_idents_hashrnd)); |
| 36 | + |
| 37 | + hash = __ipv6_addr_jhash(&addrs[1], ip6_proxy_idents_hashrnd); |
| 38 | + hash = __ipv6_addr_jhash(&addrs[0], hash); |
| 39 | + |
| 40 | + id = ip_idents_reserve(hash, 1); |
| 41 | + skb_shinfo(skb)->ip6_frag_id = htonl(id); |
| 42 | +} |
| 43 | +EXPORT_SYMBOL_GPL(ipv6_proxy_select_ident); |
| 44 | + |
11 | 45 | int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr) |
12 | 46 | { |
13 | 47 | u16 offset = sizeof(struct ipv6hdr); |
|
0 commit comments