Skip to content

Commit f37a4cc

Browse files
isilencekuba-moo
authored andcommitted
udp6: pass flow in ip6_make_skb together with cork
Another preparation patch. inet_cork_full already contains a field for iflow, so we can avoid passing a separate struct iflow6 into __ip6_append_data() and ip6_make_skb(), and use the flow stored in inet_cork_full. Make sure callers set cork->fl, i.e. we init it in ip6_append_data() and before calling ip6_make_skb(). Signed-off-by: Pavel Begunkov <[email protected]> Reviewed-by: Willem de Bruijn <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent f3b46a3 commit f37a4cc

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

include/net/ipv6.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ struct sk_buff *ip6_make_skb(struct sock *sk,
10201020
int getfrag(void *from, char *to, int offset,
10211021
int len, int odd, struct sk_buff *skb),
10221022
void *from, int length, int transhdrlen,
1023-
struct ipcm6_cookie *ipc6, struct flowi6 *fl6,
1023+
struct ipcm6_cookie *ipc6,
10241024
struct rt6_info *rt, unsigned int flags,
10251025
struct inet_cork_full *cork);
10261026

net/ipv6/ip6_output.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,7 +1350,7 @@ static void ip6_append_data_mtu(unsigned int *mtu,
13501350

13511351
static int ip6_setup_cork(struct sock *sk, struct inet_cork_full *cork,
13521352
struct inet6_cork *v6_cork, struct ipcm6_cookie *ipc6,
1353-
struct rt6_info *rt, struct flowi6 *fl6)
1353+
struct rt6_info *rt)
13541354
{
13551355
struct ipv6_pinfo *np = inet6_sk(sk);
13561356
unsigned int mtu;
@@ -1391,7 +1391,6 @@ static int ip6_setup_cork(struct sock *sk, struct inet_cork_full *cork,
13911391
}
13921392
dst_hold(&rt->dst);
13931393
cork->base.dst = &rt->dst;
1394-
cork->fl.u.ip6 = *fl6;
13951394
v6_cork->hop_limit = ipc6->hlimit;
13961395
v6_cork->tclass = ipc6->tclass;
13971396
if (rt->dst.flags & DST_XFRM_TUNNEL)
@@ -1422,7 +1421,6 @@ static int ip6_setup_cork(struct sock *sk, struct inet_cork_full *cork,
14221421
}
14231422

14241423
static int __ip6_append_data(struct sock *sk,
1425-
struct flowi6 *fl6,
14261424
struct sk_buff_head *queue,
14271425
struct inet_cork_full *cork_full,
14281426
struct inet6_cork *v6_cork,
@@ -1434,6 +1432,7 @@ static int __ip6_append_data(struct sock *sk,
14341432
{
14351433
struct sk_buff *skb, *skb_prev = NULL;
14361434
struct inet_cork *cork = &cork_full->base;
1435+
struct flowi6 *fl6 = &cork_full->fl.u.ip6;
14371436
unsigned int maxfraglen, fragheaderlen, mtu, orig_mtu, pmtu;
14381437
struct ubuf_info *uarg = NULL;
14391438
int exthdrlen = 0;
@@ -1786,19 +1785,19 @@ int ip6_append_data(struct sock *sk,
17861785
* setup for corking
17871786
*/
17881787
err = ip6_setup_cork(sk, &inet->cork, &np->cork,
1789-
ipc6, rt, fl6);
1788+
ipc6, rt);
17901789
if (err)
17911790
return err;
17921791

1792+
inet->cork.fl.u.ip6 = *fl6;
17931793
exthdrlen = (ipc6->opt ? ipc6->opt->opt_flen : 0);
17941794
length += exthdrlen;
17951795
transhdrlen += exthdrlen;
17961796
} else {
1797-
fl6 = &inet->cork.fl.u.ip6;
17981797
transhdrlen = 0;
17991798
}
18001799

1801-
return __ip6_append_data(sk, fl6, &sk->sk_write_queue, &inet->cork,
1800+
return __ip6_append_data(sk, &sk->sk_write_queue, &inet->cork,
18021801
&np->cork, sk_page_frag(sk), getfrag,
18031802
from, length, transhdrlen, flags, ipc6);
18041803
}
@@ -1967,9 +1966,8 @@ struct sk_buff *ip6_make_skb(struct sock *sk,
19671966
int getfrag(void *from, char *to, int offset,
19681967
int len, int odd, struct sk_buff *skb),
19691968
void *from, int length, int transhdrlen,
1970-
struct ipcm6_cookie *ipc6, struct flowi6 *fl6,
1971-
struct rt6_info *rt, unsigned int flags,
1972-
struct inet_cork_full *cork)
1969+
struct ipcm6_cookie *ipc6, struct rt6_info *rt,
1970+
unsigned int flags, struct inet_cork_full *cork)
19731971
{
19741972
struct inet6_cork v6_cork;
19751973
struct sk_buff_head queue;
@@ -1986,15 +1984,15 @@ struct sk_buff *ip6_make_skb(struct sock *sk,
19861984
cork->base.opt = NULL;
19871985
cork->base.dst = NULL;
19881986
v6_cork.opt = NULL;
1989-
err = ip6_setup_cork(sk, cork, &v6_cork, ipc6, rt, fl6);
1987+
err = ip6_setup_cork(sk, cork, &v6_cork, ipc6, rt);
19901988
if (err) {
19911989
ip6_cork_release(cork, &v6_cork);
19921990
return ERR_PTR(err);
19931991
}
19941992
if (ipc6->dontfrag < 0)
19951993
ipc6->dontfrag = inet6_sk(sk)->dontfrag;
19961994

1997-
err = __ip6_append_data(sk, fl6, &queue, cork, &v6_cork,
1995+
err = __ip6_append_data(sk, &queue, cork, &v6_cork,
19981996
&current->task_frag, getfrag, from,
19991997
length + exthdrlen, transhdrlen + exthdrlen,
20001998
flags, ipc6);

net/ipv6/udp.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1533,9 +1533,11 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
15331533
struct inet_cork_full cork;
15341534
struct sk_buff *skb;
15351535

1536+
cork.fl.u.ip6 = fl6;
1537+
15361538
skb = ip6_make_skb(sk, getfrag, msg, ulen,
15371539
sizeof(struct udphdr), &ipc6,
1538-
&fl6, (struct rt6_info *)dst,
1540+
(struct rt6_info *)dst,
15391541
msg->msg_flags, &cork);
15401542
err = PTR_ERR(skb);
15411543
if (!IS_ERR_OR_NULL(skb))

0 commit comments

Comments
 (0)