ip6_output.c (5fdaa88dfefa87ee1ea92750e99950dca182ea41) | ip6_output.c (678ca42d688534adfc780b150abefaaac7c86687) |
---|---|
1/* 2 * IPv6 output functions 3 * Linux INET6 implementation 4 * 5 * Authors: 6 * Pedro Roque <roque@di.fc.ul.pt> 7 * 8 * Based on linux/net/ipv4/ip_output.c --- 1207 unchanged lines hidden (view full) --- 1216 if (np->frag_size) 1217 mtu = np->frag_size; 1218 } 1219 if (mtu < IPV6_MIN_MTU) 1220 return -EINVAL; 1221 cork->base.fragsize = mtu; 1222 cork->base.gso_size = sk->sk_type == SOCK_DGRAM && 1223 sk->sk_protocol == IPPROTO_UDP ? ipc6->gso_size : 0; | 1/* 2 * IPv6 output functions 3 * Linux INET6 implementation 4 * 5 * Authors: 6 * Pedro Roque <roque@di.fc.ul.pt> 7 * 8 * Based on linux/net/ipv4/ip_output.c --- 1207 unchanged lines hidden (view full) --- 1216 if (np->frag_size) 1217 mtu = np->frag_size; 1218 } 1219 if (mtu < IPV6_MIN_MTU) 1220 return -EINVAL; 1221 cork->base.fragsize = mtu; 1222 cork->base.gso_size = sk->sk_type == SOCK_DGRAM && 1223 sk->sk_protocol == IPPROTO_UDP ? ipc6->gso_size : 0; |
1224 cork->base.tx_flags = 0; 1225 sock_tx_timestamp(sk, ipc6->sockc.tsflags, &cork->base.tx_flags); |
|
1224 1225 if (dst_allfrag(xfrm_dst_path(&rt->dst))) 1226 cork->base.flags |= IPCORK_ALLFRAG; 1227 cork->base.length = 0; 1228 1229 cork->base.transmit_time = ipc6->sockc.transmit_time; 1230 1231 return 0; --- 13 unchanged lines hidden (view full) --- 1245 struct sk_buff *skb, *skb_prev = NULL; 1246 unsigned int maxfraglen, fragheaderlen, mtu, orig_mtu, pmtu; 1247 int exthdrlen = 0; 1248 int dst_exthdrlen = 0; 1249 int hh_len; 1250 int copy; 1251 int err; 1252 int offset = 0; | 1226 1227 if (dst_allfrag(xfrm_dst_path(&rt->dst))) 1228 cork->base.flags |= IPCORK_ALLFRAG; 1229 cork->base.length = 0; 1230 1231 cork->base.transmit_time = ipc6->sockc.transmit_time; 1232 1233 return 0; --- 13 unchanged lines hidden (view full) --- 1247 struct sk_buff *skb, *skb_prev = NULL; 1248 unsigned int maxfraglen, fragheaderlen, mtu, orig_mtu, pmtu; 1249 int exthdrlen = 0; 1250 int dst_exthdrlen = 0; 1251 int hh_len; 1252 int copy; 1253 int err; 1254 int offset = 0; |
1253 __u8 tx_flags = 0; | |
1254 u32 tskey = 0; 1255 struct rt6_info *rt = (struct rt6_info *)cork->dst; 1256 struct ipv6_txoptions *opt = v6_cork->opt; 1257 int csummode = CHECKSUM_NONE; 1258 unsigned int maxnonfragsize, headersize; 1259 unsigned int wmem_alloc_delta = 0; 1260 bool paged; 1261 1262 skb = skb_peek_tail(queue); 1263 if (!skb) { 1264 exthdrlen = opt ? opt->opt_flen : 0; 1265 dst_exthdrlen = rt->dst.header_len - rt->rt6i_nfheader_len; 1266 } 1267 1268 paged = !!cork->gso_size; 1269 mtu = cork->gso_size ? IP6_MAX_MTU : cork->fragsize; 1270 orig_mtu = mtu; 1271 | 1255 u32 tskey = 0; 1256 struct rt6_info *rt = (struct rt6_info *)cork->dst; 1257 struct ipv6_txoptions *opt = v6_cork->opt; 1258 int csummode = CHECKSUM_NONE; 1259 unsigned int maxnonfragsize, headersize; 1260 unsigned int wmem_alloc_delta = 0; 1261 bool paged; 1262 1263 skb = skb_peek_tail(queue); 1264 if (!skb) { 1265 exthdrlen = opt ? opt->opt_flen : 0; 1266 dst_exthdrlen = rt->dst.header_len - rt->rt6i_nfheader_len; 1267 } 1268 1269 paged = !!cork->gso_size; 1270 mtu = cork->gso_size ? IP6_MAX_MTU : cork->fragsize; 1271 orig_mtu = mtu; 1272 |
1273 if (cork->tx_flags & SKBTX_ANY_SW_TSTAMP && 1274 sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID) 1275 tskey = sk->sk_tskey++; 1276 |
|
1272 hh_len = LL_RESERVED_SPACE(rt->dst.dev); 1273 1274 fragheaderlen = sizeof(struct ipv6hdr) + rt->rt6i_nfheader_len + 1275 (opt ? opt->opt_nflen : 0); 1276 maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen - 1277 sizeof(struct frag_hdr); 1278 1279 headersize = sizeof(struct ipv6hdr) + --- 33 unchanged lines hidden (view full) --- 1313 */ 1314 if (transhdrlen && sk->sk_protocol == IPPROTO_UDP && 1315 headersize == sizeof(struct ipv6hdr) && 1316 length <= mtu - headersize && 1317 (!(flags & MSG_MORE) || cork->gso_size) && 1318 rt->dst.dev->features & (NETIF_F_IPV6_CSUM | NETIF_F_HW_CSUM)) 1319 csummode = CHECKSUM_PARTIAL; 1320 | 1277 hh_len = LL_RESERVED_SPACE(rt->dst.dev); 1278 1279 fragheaderlen = sizeof(struct ipv6hdr) + rt->rt6i_nfheader_len + 1280 (opt ? opt->opt_nflen : 0); 1281 maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen - 1282 sizeof(struct frag_hdr); 1283 1284 headersize = sizeof(struct ipv6hdr) + --- 33 unchanged lines hidden (view full) --- 1318 */ 1319 if (transhdrlen && sk->sk_protocol == IPPROTO_UDP && 1320 headersize == sizeof(struct ipv6hdr) && 1321 length <= mtu - headersize && 1322 (!(flags & MSG_MORE) || cork->gso_size) && 1323 rt->dst.dev->features & (NETIF_F_IPV6_CSUM | NETIF_F_HW_CSUM)) 1324 csummode = CHECKSUM_PARTIAL; 1325 |
1321 if (sk->sk_type == SOCK_DGRAM || sk->sk_type == SOCK_RAW) { 1322 sock_tx_timestamp(sk, ipc6->sockc.tsflags, &tx_flags); 1323 if (tx_flags & SKBTX_ANY_SW_TSTAMP && 1324 sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID) 1325 tskey = sk->sk_tskey++; 1326 } 1327 | |
1328 /* 1329 * Let's try using as much space as possible. 1330 * Use MTU if total length of the message fits into the MTU. 1331 * Otherwise, we need to reserve fragment header and 1332 * fragment alignment (= 8-15 octects, in total). 1333 * 1334 * Note that we may need to "move" the data from the tail of 1335 * of the buffer to the new fragment when we split --- 102 unchanged lines hidden (view full) --- 1438 skb->protocol = htons(ETH_P_IPV6); 1439 skb->ip_summed = csummode; 1440 skb->csum = 0; 1441 /* reserve for fragmentation and ipsec header */ 1442 skb_reserve(skb, hh_len + sizeof(struct frag_hdr) + 1443 dst_exthdrlen); 1444 1445 /* Only the initial fragment is time stamped */ | 1326 /* 1327 * Let's try using as much space as possible. 1328 * Use MTU if total length of the message fits into the MTU. 1329 * Otherwise, we need to reserve fragment header and 1330 * fragment alignment (= 8-15 octects, in total). 1331 * 1332 * Note that we may need to "move" the data from the tail of 1333 * of the buffer to the new fragment when we split --- 102 unchanged lines hidden (view full) --- 1436 skb->protocol = htons(ETH_P_IPV6); 1437 skb->ip_summed = csummode; 1438 skb->csum = 0; 1439 /* reserve for fragmentation and ipsec header */ 1440 skb_reserve(skb, hh_len + sizeof(struct frag_hdr) + 1441 dst_exthdrlen); 1442 1443 /* Only the initial fragment is time stamped */ |
1446 skb_shinfo(skb)->tx_flags = tx_flags; 1447 tx_flags = 0; | 1444 skb_shinfo(skb)->tx_flags = cork->tx_flags; 1445 cork->tx_flags = 0; |
1448 skb_shinfo(skb)->tskey = tskey; 1449 tskey = 0; 1450 1451 /* 1452 * Find where to start putting bytes 1453 */ 1454 data = skb_put(skb, fraglen - pagedlen); 1455 skb_set_network_header(skb, exthdrlen); --- 332 unchanged lines hidden --- | 1446 skb_shinfo(skb)->tskey = tskey; 1447 tskey = 0; 1448 1449 /* 1450 * Find where to start putting bytes 1451 */ 1452 data = skb_put(skb, fraglen - pagedlen); 1453 skb_set_network_header(skb, exthdrlen); --- 332 unchanged lines hidden --- |