ip6_output.c (b60d4e58c615d36a6c4e1a374786826da893fcd0) | ip6_output.c (d656b2ea5fa797e515cd609ba5f4202901f3c466) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * IPv6 output functions 4 * Linux INET6 implementation 5 * 6 * Authors: 7 * Pedro Roque <roque@di.fc.ul.pt> 8 * --- 1340 unchanged lines hidden (view full) --- 1349} 1350 1351static int ip6_setup_cork(struct sock *sk, struct inet_cork_full *cork, 1352 struct inet6_cork *v6_cork, struct ipcm6_cookie *ipc6, 1353 struct rt6_info *rt, struct flowi6 *fl6) 1354{ 1355 struct ipv6_pinfo *np = inet6_sk(sk); 1356 unsigned int mtu; | 1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * IPv6 output functions 4 * Linux INET6 implementation 5 * 6 * Authors: 7 * Pedro Roque <roque@di.fc.ul.pt> 8 * --- 1340 unchanged lines hidden (view full) --- 1349} 1350 1351static int ip6_setup_cork(struct sock *sk, struct inet_cork_full *cork, 1352 struct inet6_cork *v6_cork, struct ipcm6_cookie *ipc6, 1353 struct rt6_info *rt, struct flowi6 *fl6) 1354{ 1355 struct ipv6_pinfo *np = inet6_sk(sk); 1356 unsigned int mtu; |
1357 struct ipv6_txoptions *opt = ipc6->opt; | 1357 struct ipv6_txoptions *nopt, *opt = ipc6->opt; |
1358 1359 /* 1360 * setup for corking 1361 */ 1362 if (opt) { 1363 if (WARN_ON(v6_cork->opt)) 1364 return -EINVAL; 1365 | 1358 1359 /* 1360 * setup for corking 1361 */ 1362 if (opt) { 1363 if (WARN_ON(v6_cork->opt)) 1364 return -EINVAL; 1365 |
1366 v6_cork->opt = kzalloc(sizeof(*opt), sk->sk_allocation); 1367 if (unlikely(!v6_cork->opt)) | 1366 nopt = v6_cork->opt = kzalloc(sizeof(*opt), sk->sk_allocation); 1367 if (unlikely(!nopt)) |
1368 return -ENOBUFS; 1369 | 1368 return -ENOBUFS; 1369 |
1370 v6_cork->opt->tot_len = sizeof(*opt); 1371 v6_cork->opt->opt_flen = opt->opt_flen; 1372 v6_cork->opt->opt_nflen = opt->opt_nflen; | 1370 nopt->tot_len = sizeof(*opt); 1371 nopt->opt_flen = opt->opt_flen; 1372 nopt->opt_nflen = opt->opt_nflen; |
1373 | 1373 |
1374 v6_cork->opt->dst0opt = ip6_opt_dup(opt->dst0opt, 1375 sk->sk_allocation); 1376 if (opt->dst0opt && !v6_cork->opt->dst0opt) | 1374 nopt->dst0opt = ip6_opt_dup(opt->dst0opt, sk->sk_allocation); 1375 if (opt->dst0opt && !nopt->dst0opt) |
1377 return -ENOBUFS; 1378 | 1376 return -ENOBUFS; 1377 |
1379 v6_cork->opt->dst1opt = ip6_opt_dup(opt->dst1opt, 1380 sk->sk_allocation); 1381 if (opt->dst1opt && !v6_cork->opt->dst1opt) | 1378 nopt->dst1opt = ip6_opt_dup(opt->dst1opt, sk->sk_allocation); 1379 if (opt->dst1opt && !nopt->dst1opt) |
1382 return -ENOBUFS; 1383 | 1380 return -ENOBUFS; 1381 |
1384 v6_cork->opt->hopopt = ip6_opt_dup(opt->hopopt, 1385 sk->sk_allocation); 1386 if (opt->hopopt && !v6_cork->opt->hopopt) | 1382 nopt->hopopt = ip6_opt_dup(opt->hopopt, sk->sk_allocation); 1383 if (opt->hopopt && !nopt->hopopt) |
1387 return -ENOBUFS; 1388 | 1384 return -ENOBUFS; 1385 |
1389 v6_cork->opt->srcrt = ip6_rthdr_dup(opt->srcrt, 1390 sk->sk_allocation); 1391 if (opt->srcrt && !v6_cork->opt->srcrt) | 1386 nopt->srcrt = ip6_rthdr_dup(opt->srcrt, sk->sk_allocation); 1387 if (opt->srcrt && !nopt->srcrt) |
1392 return -ENOBUFS; 1393 1394 /* need source address above miyazawa*/ 1395 } 1396 dst_hold(&rt->dst); 1397 cork->base.dst = &rt->dst; 1398 cork->fl.u.ip6 = *fl6; 1399 v6_cork->hop_limit = ipc6->hlimit; --- 415 unchanged lines hidden (view full) --- 1815 cork->base.flags &= ~IPCORK_ALLFRAG; 1816 skb_dst_set(skb, dst); 1817} 1818 1819static void ip6_cork_release(struct inet_cork_full *cork, 1820 struct inet6_cork *v6_cork) 1821{ 1822 if (v6_cork->opt) { | 1388 return -ENOBUFS; 1389 1390 /* need source address above miyazawa*/ 1391 } 1392 dst_hold(&rt->dst); 1393 cork->base.dst = &rt->dst; 1394 cork->fl.u.ip6 = *fl6; 1395 v6_cork->hop_limit = ipc6->hlimit; --- 415 unchanged lines hidden (view full) --- 1811 cork->base.flags &= ~IPCORK_ALLFRAG; 1812 skb_dst_set(skb, dst); 1813} 1814 1815static void ip6_cork_release(struct inet_cork_full *cork, 1816 struct inet6_cork *v6_cork) 1817{ 1818 if (v6_cork->opt) { |
1823 kfree(v6_cork->opt->dst0opt); 1824 kfree(v6_cork->opt->dst1opt); 1825 kfree(v6_cork->opt->hopopt); 1826 kfree(v6_cork->opt->srcrt); 1827 kfree(v6_cork->opt); | 1819 struct ipv6_txoptions *opt = v6_cork->opt; 1820 1821 kfree(opt->dst0opt); 1822 kfree(opt->dst1opt); 1823 kfree(opt->hopopt); 1824 kfree(opt->srcrt); 1825 kfree(opt); |
1828 v6_cork->opt = NULL; 1829 } 1830 1831 if (cork->base.dst) { 1832 dst_release(cork->base.dst); 1833 cork->base.dst = NULL; 1834 cork->base.flags &= ~IPCORK_ALLFRAG; 1835 } --- 174 unchanged lines hidden --- | 1826 v6_cork->opt = NULL; 1827 } 1828 1829 if (cork->base.dst) { 1830 dst_release(cork->base.dst); 1831 cork->base.dst = NULL; 1832 cork->base.flags &= ~IPCORK_ALLFRAG; 1833 } --- 174 unchanged lines hidden --- |