2 * IPv6 library code, needed by static components when full IPv6 support is
3 * not configured or static. These functions are needed by GSO/GRO implementation.
5 #include <linux/export.h>
7 #include <net/ip6_fib.h>
9 void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt)
11 static atomic_t ipv6_fragmentation_id;
14 #if IS_ENABLED(CONFIG_IPV6)
15 if (rt && !(rt->dst.flags & DST_NOPEER)) {
16 struct inet_peer *peer;
19 net = dev_net(rt->dst.dev);
20 peer = inet_getpeer_v6(net->ipv6.peers, &rt->rt6i_dst.addr, 1);
22 fhdr->identification = htonl(inet_getid(peer, 0));
29 old = atomic_read(&ipv6_fragmentation_id);
33 } while (atomic_cmpxchg(&ipv6_fragmentation_id, old, new) != old);
34 fhdr->identification = htonl(new);
36 EXPORT_SYMBOL(ipv6_select_ident);
38 int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr)
40 u16 offset = sizeof(struct ipv6hdr);
41 struct ipv6_opt_hdr *exthdr =
42 (struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1);
43 unsigned int packet_len = skb_tail_pointer(skb) -
44 skb_network_header(skb);
46 *nexthdr = &ipv6_hdr(skb)->nexthdr;
48 while (offset + 1 <= packet_len) {
58 #if IS_ENABLED(CONFIG_IPV6_MIP6)
59 if (ipv6_find_tlv(skb, offset, IPV6_TLV_HAO) >= 0)
69 offset += ipv6_optlen(exthdr);
70 *nexthdr = &exthdr->nexthdr;
71 exthdr = (struct ipv6_opt_hdr *)(skb_network_header(skb) +
77 EXPORT_SYMBOL(ip6_find_1stfragopt);