Skip to content

Commit 5cc5fa7

Browse files
qsngregkh
authored andcommitted
net: ipv6: add net argument to ip6_dst_lookup_flow
commit c4e85f7 upstream. This will be used in the conversion of ipv6_stub to ip6_dst_lookup_flow, as some modules currently pass a net argument without a socket to ip6_dst_lookup. This is equivalent to commit 343d60a ("ipv6: change ipv6_stub_impl.ipv6_dst_lookup to take net argument"). Signed-off-by: Sabrina Dubroca <[email protected]> Signed-off-by: David S. Miller <[email protected]> [bwh: Backported to 4.9: adjust context] Signed-off-by: Ben Hutchings <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent e94c149 commit 5cc5fa7

File tree

11 files changed

+19
-19
lines changed

11 files changed

+19
-19
lines changed

include/net/ipv6.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ static inline struct sk_buff *ip6_finish_skb(struct sock *sk)
856856

857857
int ip6_dst_lookup(struct net *net, struct sock *sk, struct dst_entry **dst,
858858
struct flowi6 *fl6);
859-
struct dst_entry *ip6_dst_lookup_flow(const struct sock *sk, struct flowi6 *fl6,
859+
struct dst_entry *ip6_dst_lookup_flow(struct net *net, const struct sock *sk, struct flowi6 *fl6,
860860
const struct in6_addr *final_dst);
861861
struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6,
862862
const struct in6_addr *final_dst);

net/dccp/ipv6.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ static int dccp_v6_send_response(const struct sock *sk, struct request_sock *req
209209
final_p = fl6_update_dst(&fl6, rcu_dereference(np->opt), &final);
210210
rcu_read_unlock();
211211

212-
dst = ip6_dst_lookup_flow(sk, &fl6, final_p);
212+
dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p);
213213
if (IS_ERR(dst)) {
214214
err = PTR_ERR(dst);
215215
dst = NULL;
@@ -280,7 +280,7 @@ static void dccp_v6_ctl_send_reset(const struct sock *sk, struct sk_buff *rxskb)
280280
security_skb_classify_flow(rxskb, flowi6_to_flowi(&fl6));
281281

282282
/* sk = NULL, but it is safe for now. RST socket required. */
283-
dst = ip6_dst_lookup_flow(ctl_sk, &fl6, NULL);
283+
dst = ip6_dst_lookup_flow(sock_net(ctl_sk), ctl_sk, &fl6, NULL);
284284
if (!IS_ERR(dst)) {
285285
skb_dst_set(skb, dst);
286286
ip6_xmit(ctl_sk, skb, &fl6, 0, NULL, 0);
@@ -889,7 +889,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
889889
opt = rcu_dereference_protected(np->opt, lockdep_sock_is_held(sk));
890890
final_p = fl6_update_dst(&fl6, opt, &final);
891891

892-
dst = ip6_dst_lookup_flow(sk, &fl6, final_p);
892+
dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p);
893893
if (IS_ERR(dst)) {
894894
err = PTR_ERR(dst);
895895
goto failure;

net/ipv6/af_inet6.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ int inet6_sk_rebuild_header(struct sock *sk)
702702
&final);
703703
rcu_read_unlock();
704704

705-
dst = ip6_dst_lookup_flow(sk, &fl6, final_p);
705+
dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p);
706706
if (IS_ERR(dst)) {
707707
sk->sk_route_caps = 0;
708708
sk->sk_err_soft = -PTR_ERR(dst);

net/ipv6/datagram.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ int ip6_datagram_dst_update(struct sock *sk, bool fix_sk_saddr)
8787
final_p = fl6_update_dst(&fl6, opt, &final);
8888
rcu_read_unlock();
8989

90-
dst = ip6_dst_lookup_flow(sk, &fl6, final_p);
90+
dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p);
9191
if (IS_ERR(dst)) {
9292
err = PTR_ERR(dst);
9393
goto out;

net/ipv6/inet6_connection_sock.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ struct dst_entry *inet6_csk_route_req(const struct sock *sk,
9090
fl6->fl6_sport = htons(ireq->ir_num);
9191
security_req_classify_flow(req, flowi6_to_flowi(fl6));
9292

93-
dst = ip6_dst_lookup_flow(sk, fl6, final_p);
93+
dst = ip6_dst_lookup_flow(sock_net(sk), sk, fl6, final_p);
9494
if (IS_ERR(dst))
9595
return NULL;
9696

@@ -144,7 +144,7 @@ static struct dst_entry *inet6_csk_route_socket(struct sock *sk,
144144

145145
dst = __inet6_csk_dst_check(sk, np->dst_cookie);
146146
if (!dst) {
147-
dst = ip6_dst_lookup_flow(sk, fl6, final_p);
147+
dst = ip6_dst_lookup_flow(sock_net(sk), sk, fl6, final_p);
148148

149149
if (!IS_ERR(dst))
150150
ip6_dst_store(sk, dst, NULL, NULL);

net/ipv6/ip6_output.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,19 +1075,19 @@ EXPORT_SYMBOL_GPL(ip6_dst_lookup);
10751075
* It returns a valid dst pointer on success, or a pointer encoded
10761076
* error code.
10771077
*/
1078-
struct dst_entry *ip6_dst_lookup_flow(const struct sock *sk, struct flowi6 *fl6,
1078+
struct dst_entry *ip6_dst_lookup_flow(struct net *net, const struct sock *sk, struct flowi6 *fl6,
10791079
const struct in6_addr *final_dst)
10801080
{
10811081
struct dst_entry *dst = NULL;
10821082
int err;
10831083

1084-
err = ip6_dst_lookup_tail(sock_net(sk), sk, &dst, fl6);
1084+
err = ip6_dst_lookup_tail(net, sk, &dst, fl6);
10851085
if (err)
10861086
return ERR_PTR(err);
10871087
if (final_dst)
10881088
fl6->daddr = *final_dst;
10891089

1090-
return xfrm_lookup_route(sock_net(sk), dst, flowi6_to_flowi(fl6), sk, 0);
1090+
return xfrm_lookup_route(net, dst, flowi6_to_flowi(fl6), sk, 0);
10911091
}
10921092
EXPORT_SYMBOL_GPL(ip6_dst_lookup_flow);
10931093

@@ -1112,7 +1112,7 @@ struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6,
11121112

11131113
dst = ip6_sk_dst_check(sk, dst, fl6);
11141114
if (!dst)
1115-
dst = ip6_dst_lookup_flow(sk, fl6, final_dst);
1115+
dst = ip6_dst_lookup_flow(sock_net(sk), sk, fl6, final_dst);
11161116

11171117
return dst;
11181118
}

net/ipv6/raw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
920920

921921
fl6.flowlabel = ip6_make_flowinfo(ipc6.tclass, fl6.flowlabel);
922922

923-
dst = ip6_dst_lookup_flow(sk, &fl6, final_p);
923+
dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p);
924924
if (IS_ERR(dst)) {
925925
err = PTR_ERR(dst);
926926
goto out;

net/ipv6/syncookies.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
230230
fl6.fl6_sport = inet_sk(sk)->inet_sport;
231231
security_req_classify_flow(req, flowi6_to_flowi(&fl6));
232232

233-
dst = ip6_dst_lookup_flow(sk, &fl6, final_p);
233+
dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p);
234234
if (IS_ERR(dst))
235235
goto out_free;
236236
}

net/ipv6/tcp_ipv6.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
244244

245245
security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
246246

247-
dst = ip6_dst_lookup_flow(sk, &fl6, final_p);
247+
dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p);
248248
if (IS_ERR(dst)) {
249249
err = PTR_ERR(dst);
250250
goto failure;
@@ -841,7 +841,7 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32
841841
* Underlying function will use this to retrieve the network
842842
* namespace
843843
*/
844-
dst = ip6_dst_lookup_flow(ctl_sk, &fl6, NULL);
844+
dst = ip6_dst_lookup_flow(sock_net(ctl_sk), ctl_sk, &fl6, NULL);
845845
if (!IS_ERR(dst)) {
846846
skb_dst_set(buff, dst);
847847
ip6_xmit(ctl_sk, buff, &fl6, fl6.flowi6_mark, NULL, tclass);

net/l2tp/l2tp_ip6.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ static int l2tp_ip6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
620620

621621
fl6.flowlabel = ip6_make_flowinfo(ipc6.tclass, fl6.flowlabel);
622622

623-
dst = ip6_dst_lookup_flow(sk, &fl6, final_p);
623+
dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p);
624624
if (IS_ERR(dst)) {
625625
err = PTR_ERR(dst);
626626
goto out;

0 commit comments

Comments
 (0)