xfrm6_input.c (e377240a8eb06fb3ea1e77d3e252d79bbfa5d490) xfrm6_input.c (53a5b4f2ea858482a427878bca988a7fa9b2ebdc)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * xfrm6_input.c: based on net/ipv4/xfrm4_input.c
4 *
5 * Authors:
6 * Mitsuru KANDA @USAGI
7 * Kazunori MIYAZAWA @USAGI
8 * Kunihiro Ishiguro <kunihiro@ipinfusion.com>

--- 66 unchanged lines hidden (view full) ---

75 struct udphdr *uh;
76 struct ipv6hdr *ip6h;
77 int len;
78 int ip6hlen = sizeof(struct ipv6hdr);
79 __u8 *udpdata;
80 __be32 *udpdata32;
81 u16 encap_type;
82
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * xfrm6_input.c: based on net/ipv4/xfrm4_input.c
4 *
5 * Authors:
6 * Mitsuru KANDA @USAGI
7 * Kazunori MIYAZAWA @USAGI
8 * Kunihiro Ishiguro <kunihiro@ipinfusion.com>

--- 66 unchanged lines hidden (view full) ---

75 struct udphdr *uh;
76 struct ipv6hdr *ip6h;
77 int len;
78 int ip6hlen = sizeof(struct ipv6hdr);
79 __u8 *udpdata;
80 __be32 *udpdata32;
81 u16 encap_type;
82
83 if (skb->protocol == htons(ETH_P_IP))
84 return xfrm4_udp_encap_rcv(sk, skb);
85
86 encap_type = READ_ONCE(up->encap_type);
87 /* if this is not encapsulated socket, then just return now */
88 if (!encap_type)
89 return 1;
90
91 /* If this is a paged skb, make sure we pull up
92 * whatever data we need to look at. */
93 len = skb->len - sizeof(struct udphdr);

--- 70 unchanged lines hidden (view full) ---

164 * Returns 0 if skb passed to xfrm or was dropped.
165 * Returns >0 if skb should be passed to UDP.
166 * Returns <0 if skb should be resubmitted (-ret is protocol)
167 */
168int xfrm6_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
169{
170 int ret;
171
83 encap_type = READ_ONCE(up->encap_type);
84 /* if this is not encapsulated socket, then just return now */
85 if (!encap_type)
86 return 1;
87
88 /* If this is a paged skb, make sure we pull up
89 * whatever data we need to look at. */
90 len = skb->len - sizeof(struct udphdr);

--- 70 unchanged lines hidden (view full) ---

161 * Returns 0 if skb passed to xfrm or was dropped.
162 * Returns >0 if skb should be passed to UDP.
163 * Returns <0 if skb should be resubmitted (-ret is protocol)
164 */
165int xfrm6_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
166{
167 int ret;
168
169 if (skb->protocol == htons(ETH_P_IP))
170 return xfrm4_udp_encap_rcv(sk, skb);
171
172 ret = __xfrm6_udp_encap_rcv(sk, skb, true);
173 if (!ret)
174 return xfrm6_rcv_encap(skb, IPPROTO_ESP, 0,
175 udp_sk(sk)->encap_type);
176
177 if (ret < 0) {
178 kfree_skb(skb);
179 return 0;

--- 5 unchanged lines hidden (view full) ---

185struct sk_buff *xfrm6_gro_udp_encap_rcv(struct sock *sk, struct list_head *head,
186 struct sk_buff *skb)
187{
188 int offset = skb_gro_offset(skb);
189 const struct net_offload *ops;
190 struct sk_buff *pp = NULL;
191 int ret;
192
172 ret = __xfrm6_udp_encap_rcv(sk, skb, true);
173 if (!ret)
174 return xfrm6_rcv_encap(skb, IPPROTO_ESP, 0,
175 udp_sk(sk)->encap_type);
176
177 if (ret < 0) {
178 kfree_skb(skb);
179 return 0;

--- 5 unchanged lines hidden (view full) ---

185struct sk_buff *xfrm6_gro_udp_encap_rcv(struct sock *sk, struct list_head *head,
186 struct sk_buff *skb)
187{
188 int offset = skb_gro_offset(skb);
189 const struct net_offload *ops;
190 struct sk_buff *pp = NULL;
191 int ret;
192
193 if (skb->protocol == htons(ETH_P_IP))
194 return xfrm4_gro_udp_encap_rcv(sk, head, skb);
195
193 offset = offset - sizeof(struct udphdr);
194
195 if (!pskb_pull(skb, offset))
196 return NULL;
197
198 rcu_read_lock();
199 ops = rcu_dereference(inet6_offloads[IPPROTO_ESP]);
200 if (!ops || !ops->callbacks.gro_receive)

--- 116 unchanged lines hidden ---
196 offset = offset - sizeof(struct udphdr);
197
198 if (!pskb_pull(skb, offset))
199 return NULL;
200
201 rcu_read_lock();
202 ops = rcu_dereference(inet6_offloads[IPPROTO_ESP]);
203 if (!ops || !ops->callbacks.gro_receive)

--- 116 unchanged lines hidden ---