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>
8 #include <net/addrconf.h>
9 #include <net/secure_seq.h>
11 int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr)
13 u16 offset = sizeof(struct ipv6hdr);
14 struct ipv6_opt_hdr *exthdr =
15 (struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1);
16 unsigned int packet_len = skb_tail_pointer(skb) -
17 skb_network_header(skb);
19 *nexthdr = &ipv6_hdr(skb)->nexthdr;
21 while (offset + 1 <= packet_len) {
31 #if IS_ENABLED(CONFIG_IPV6_MIP6)
32 if (ipv6_find_tlv(skb, offset, IPV6_TLV_HAO) >= 0)
42 offset += ipv6_optlen(exthdr);
43 *nexthdr = &exthdr->nexthdr;
44 exthdr = (struct ipv6_opt_hdr *)(skb_network_header(skb) +
50 EXPORT_SYMBOL(ip6_find_1stfragopt);
52 #if IS_ENABLED(CONFIG_IPV6)
53 int ip6_dst_hoplimit(struct dst_entry *dst)
55 int hoplimit = dst_metric_raw(dst, RTAX_HOPLIMIT);
57 struct net_device *dev = dst->dev;
58 struct inet6_dev *idev;
61 idev = __in6_dev_get(dev);
63 hoplimit = idev->cnf.hop_limit;
65 hoplimit = dev_net(dev)->ipv6.devconf_all->hop_limit;
70 EXPORT_SYMBOL(ip6_dst_hoplimit);
73 int __ip6_local_out(struct sk_buff *skb)
77 len = skb->len - sizeof(struct ipv6hdr);
78 if (len > IPV6_MAXPLEN)
80 ipv6_hdr(skb)->payload_len = htons(len);
81 IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr);
83 return nf_hook(NFPROTO_IPV6, NF_INET_LOCAL_OUT, skb, NULL,
84 skb_dst(skb)->dev, dst_output);
86 EXPORT_SYMBOL_GPL(__ip6_local_out);
88 int ip6_local_out(struct sk_buff *skb)
92 err = __ip6_local_out(skb);
94 err = dst_output(skb);
98 EXPORT_SYMBOL_GPL(ip6_local_out);