aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ip_output.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/ip_output.c')
-rw-r--r--net/ipv4/ip_output.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 3982eabf61e1..8fbac7de1e1b 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1065,6 +1065,9 @@ static int ip_setup_cork(struct sock *sk, struct inet_cork *cork,
1065 rt->dst.dev->mtu : dst_mtu(&rt->dst); 1065 rt->dst.dev->mtu : dst_mtu(&rt->dst);
1066 cork->dst = &rt->dst; 1066 cork->dst = &rt->dst;
1067 cork->length = 0; 1067 cork->length = 0;
1068 cork->ttl = ipc->ttl;
1069 cork->tos = ipc->tos;
1070 cork->priority = ipc->priority;
1068 cork->tx_flags = ipc->tx_flags; 1071 cork->tx_flags = ipc->tx_flags;
1069 1072
1070 return 0; 1073 return 0;
@@ -1316,7 +1319,9 @@ struct sk_buff *__ip_make_skb(struct sock *sk,
1316 if (cork->flags & IPCORK_OPT) 1319 if (cork->flags & IPCORK_OPT)
1317 opt = cork->opt; 1320 opt = cork->opt;
1318 1321
1319 if (rt->rt_type == RTN_MULTICAST) 1322 if (cork->ttl != 0)
1323 ttl = cork->ttl;
1324 else if (rt->rt_type == RTN_MULTICAST)
1320 ttl = inet->mc_ttl; 1325 ttl = inet->mc_ttl;
1321 else 1326 else
1322 ttl = ip_select_ttl(inet, &rt->dst); 1327 ttl = ip_select_ttl(inet, &rt->dst);
@@ -1324,7 +1329,7 @@ struct sk_buff *__ip_make_skb(struct sock *sk,
1324 iph = ip_hdr(skb); 1329 iph = ip_hdr(skb);
1325 iph->version = 4; 1330 iph->version = 4;
1326 iph->ihl = 5; 1331 iph->ihl = 5;
1327 iph->tos = inet->tos; 1332 iph->tos = (cork->tos != -1) ? cork->tos : inet->tos;
1328 iph->frag_off = df; 1333 iph->frag_off = df;
1329 iph->ttl = ttl; 1334 iph->ttl = ttl;
1330 iph->protocol = sk->sk_protocol; 1335 iph->protocol = sk->sk_protocol;
@@ -1336,7 +1341,7 @@ struct sk_buff *__ip_make_skb(struct sock *sk,
1336 ip_options_build(skb, opt, cork->addr, rt, 0); 1341 ip_options_build(skb, opt, cork->addr, rt, 0);
1337 } 1342 }
1338 1343
1339 skb->priority = sk->sk_priority; 1344 skb->priority = (cork->tos != -1) ? cork->priority: sk->sk_priority;
1340 skb->mark = sk->sk_mark; 1345 skb->mark = sk->sk_mark;
1341 /* 1346 /*
1342 * Steal rt from cork.dst to avoid a pair of atomic_inc/atomic_dec 1347 * Steal rt from cork.dst to avoid a pair of atomic_inc/atomic_dec
@@ -1486,6 +1491,8 @@ void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr,
1486 ipc.addr = daddr; 1491 ipc.addr = daddr;
1487 ipc.opt = NULL; 1492 ipc.opt = NULL;
1488 ipc.tx_flags = 0; 1493 ipc.tx_flags = 0;
1494 ipc.ttl = 0;
1495 ipc.tos = -1;
1489 1496
1490 if (replyopts.opt.opt.optlen) { 1497 if (replyopts.opt.opt.optlen) {
1491 ipc.opt = &replyopts.opt; 1498 ipc.opt = &replyopts.opt;