Commit 4bedb45203eab92a87b4c863fe2d0cded633427f
Committed by
David S. Miller
1 parent
d9edf9e2be
Exists in
master
and in
20 other branches
[SK_BUFF]: Introduce udp_hdr(), remove skb->h.uh
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 12 changed files with 34 additions and 24 deletions Side-by-side Diff
drivers/net/gianfar.c
... | ... | @@ -944,9 +944,9 @@ |
944 | 944 | /* And provide the already calculated phcs */ |
945 | 945 | if (ip_hdr(skb)->protocol == IPPROTO_UDP) { |
946 | 946 | flags |= TXFCB_UDP; |
947 | - fcb->phcs = skb->h.uh->check; | |
947 | + fcb->phcs = udp_hdr(skb)->check; | |
948 | 948 | } else |
949 | - fcb->phcs = skb->h.th->check; | |
949 | + fcb->phcs = udp_hdr(skb)->check; | |
950 | 950 | |
951 | 951 | /* l3os is the distance between the start of the |
952 | 952 | * frame (skb->data) and the start of the IP hdr. |
drivers/net/ioc3-eth.c
... | ... | @@ -1422,7 +1422,7 @@ |
1422 | 1422 | csoff = ETH_HLEN + (ih->ihl << 2); |
1423 | 1423 | if (proto == IPPROTO_UDP) { |
1424 | 1424 | csoff += offsetof(struct udphdr, check); |
1425 | - skb->h.uh->check = csum; | |
1425 | + udp_hdr(skb)->check = csum; | |
1426 | 1426 | } |
1427 | 1427 | if (proto == IPPROTO_TCP) { |
1428 | 1428 | csoff += offsetof(struct tcphdr, check); |
drivers/net/mv643xx_eth.c
... | ... | @@ -1166,7 +1166,7 @@ |
1166 | 1166 | switch (ip_hdr(skb)->protocol) { |
1167 | 1167 | case IPPROTO_UDP: |
1168 | 1168 | cmd_sts |= ETH_UDP_FRAME; |
1169 | - desc->l4i_chk = skb->h.uh->check; | |
1169 | + desc->l4i_chk = udp_hdr(skb)->check; | |
1170 | 1170 | break; |
1171 | 1171 | case IPPROTO_TCP: |
1172 | 1172 | desc->l4i_chk = skb->h.th->check; |
include/linux/skbuff.h
include/linux/udp.h
... | ... | @@ -26,6 +26,15 @@ |
26 | 26 | __sum16 check; |
27 | 27 | }; |
28 | 28 | |
29 | +#ifdef __KERNEL__ | |
30 | +#include <linux/skbuff.h> | |
31 | + | |
32 | +static inline struct udphdr *udp_hdr(const struct sk_buff *skb) | |
33 | +{ | |
34 | + return (struct udphdr *)skb->h.raw; | |
35 | +} | |
36 | +#endif | |
37 | + | |
29 | 38 | /* UDP socket options */ |
30 | 39 | #define UDP_CORK 1 /* Never send partially complete segments */ |
31 | 40 | #define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */ |
include/net/udplite.h
... | ... | @@ -101,7 +101,7 @@ |
101 | 101 | |
102 | 102 | static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb) |
103 | 103 | { |
104 | - int cscov = udplite_sender_cscov(udp_sk(sk), skb->h.uh); | |
104 | + int cscov = udplite_sender_cscov(udp_sk(sk), udp_hdr(skb)); | |
105 | 105 | __wsum csum = 0; |
106 | 106 | |
107 | 107 | skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */ |
net/core/netpoll.c
... | ... | @@ -296,7 +296,9 @@ |
296 | 296 | memcpy(skb->data, msg, len); |
297 | 297 | skb->len += len; |
298 | 298 | |
299 | - skb->h.uh = udph = (struct udphdr *) skb_push(skb, sizeof(*udph)); | |
299 | + skb_push(skb, sizeof(*udph)); | |
300 | + skb_reset_transport_header(skb); | |
301 | + udph = udp_hdr(skb); | |
300 | 302 | udph->source = htons(np->local_port); |
301 | 303 | udph->dest = htons(np->remote_port); |
302 | 304 | udph->len = htons(udp_len); |
net/core/pktgen.c
... | ... | @@ -2392,7 +2392,7 @@ |
2392 | 2392 | skb->dev = odev; |
2393 | 2393 | skb->pkt_type = PACKET_HOST; |
2394 | 2394 | skb->nh.raw = (unsigned char *)iph; |
2395 | - skb->h.uh = udph; | |
2395 | + skb->h.raw = (unsigned char *)udph; | |
2396 | 2396 | |
2397 | 2397 | if (pkt_dev->nfrags <= 0) |
2398 | 2398 | pgh = (struct pktgen_hdr *)skb_put(skb, datalen); |
... | ... | @@ -2737,7 +2737,7 @@ |
2737 | 2737 | skb->dev = odev; |
2738 | 2738 | skb->pkt_type = PACKET_HOST; |
2739 | 2739 | skb->nh.raw = (unsigned char *)iph; |
2740 | - skb->h.uh = udph; | |
2740 | + skb->h.raw = (unsigned char *)udph; | |
2741 | 2741 | |
2742 | 2742 | if (pkt_dev->nfrags <= 0) |
2743 | 2743 | pgh = (struct pktgen_hdr *)skb_put(skb, datalen); |
net/ipv4/udp.c
... | ... | @@ -420,7 +420,7 @@ |
420 | 420 | __be32 src, __be32 dst, int len ) |
421 | 421 | { |
422 | 422 | unsigned int offset; |
423 | - struct udphdr *uh = skb->h.uh; | |
423 | + struct udphdr *uh = udp_hdr(skb); | |
424 | 424 | __wsum csum = 0; |
425 | 425 | |
426 | 426 | if (skb_queue_len(&sk->sk_write_queue) == 1) { |
... | ... | @@ -470,7 +470,7 @@ |
470 | 470 | /* |
471 | 471 | * Create a UDP header |
472 | 472 | */ |
473 | - uh = skb->h.uh; | |
473 | + uh = udp_hdr(skb); | |
474 | 474 | uh->source = fl->fl_ip_sport; |
475 | 475 | uh->dest = fl->fl_ip_dport; |
476 | 476 | uh->len = htons(up->len); |
... | ... | @@ -866,7 +866,7 @@ |
866 | 866 | if (sin) |
867 | 867 | { |
868 | 868 | sin->sin_family = AF_INET; |
869 | - sin->sin_port = skb->h.uh->source; | |
869 | + sin->sin_port = udp_hdr(skb)->source; | |
870 | 870 | sin->sin_addr.s_addr = ip_hdr(skb)->saddr; |
871 | 871 | memset(sin->sin_zero, 0, sizeof(sin->sin_zero)); |
872 | 872 | } |
... | ... | @@ -949,7 +949,7 @@ |
949 | 949 | return 1; |
950 | 950 | |
951 | 951 | /* Now we can get the pointers */ |
952 | - uh = skb->h.uh; | |
952 | + uh = udp_hdr(skb); | |
953 | 953 | udpdata = (__u8 *)uh + sizeof(struct udphdr); |
954 | 954 | udpdata32 = (__be32 *)udpdata; |
955 | 955 | |
... | ... | @@ -1207,7 +1207,7 @@ |
1207 | 1207 | int proto) |
1208 | 1208 | { |
1209 | 1209 | struct sock *sk; |
1210 | - struct udphdr *uh = skb->h.uh; | |
1210 | + struct udphdr *uh = udp_hdr(skb); | |
1211 | 1211 | unsigned short ulen; |
1212 | 1212 | struct rtable *rt = (struct rtable*)skb->dst; |
1213 | 1213 | __be32 saddr = ip_hdr(skb)->saddr; |
... | ... | @@ -1227,7 +1227,7 @@ |
1227 | 1227 | /* UDP validates ulen. */ |
1228 | 1228 | if (ulen < sizeof(*uh) || pskb_trim_rcsum(skb, ulen)) |
1229 | 1229 | goto short_packet; |
1230 | - uh = skb->h.uh; | |
1230 | + uh = udp_hdr(skb); | |
1231 | 1231 | } |
1232 | 1232 | |
1233 | 1233 | if (udp4_csum_init(skb, uh, proto)) |
net/ipv6/udp.c
... | ... | @@ -172,7 +172,7 @@ |
172 | 172 | |
173 | 173 | sin6 = (struct sockaddr_in6 *) msg->msg_name; |
174 | 174 | sin6->sin6_family = AF_INET6; |
175 | - sin6->sin6_port = skb->h.uh->source; | |
175 | + sin6->sin6_port = udp_hdr(skb)->source; | |
176 | 176 | sin6->sin6_flowinfo = 0; |
177 | 177 | sin6->sin6_scope_id = 0; |
178 | 178 | |
... | ... | @@ -346,7 +346,7 @@ |
346 | 346 | struct in6_addr *daddr, struct hlist_head udptable[]) |
347 | 347 | { |
348 | 348 | struct sock *sk, *sk2; |
349 | - const struct udphdr *uh = skb->h.uh; | |
349 | + const struct udphdr *uh = udp_hdr(skb); | |
350 | 350 | int dif; |
351 | 351 | |
352 | 352 | read_lock(&udp_hash_lock); |
... | ... | @@ -420,7 +420,7 @@ |
420 | 420 | |
421 | 421 | saddr = &ipv6_hdr(skb)->saddr; |
422 | 422 | daddr = &ipv6_hdr(skb)->daddr; |
423 | - uh = skb->h.uh; | |
423 | + uh = udp_hdr(skb); | |
424 | 424 | |
425 | 425 | ulen = ntohs(uh->len); |
426 | 426 | if (ulen > skb->len) |
... | ... | @@ -441,7 +441,7 @@ |
441 | 441 | goto short_packet; |
442 | 442 | saddr = &ipv6_hdr(skb)->saddr; |
443 | 443 | daddr = &ipv6_hdr(skb)->daddr; |
444 | - uh = skb->h.uh; | |
444 | + uh = udp_hdr(skb); | |
445 | 445 | } |
446 | 446 | } |
447 | 447 | |
... | ... | @@ -534,7 +534,7 @@ |
534 | 534 | /* |
535 | 535 | * Create a UDP header |
536 | 536 | */ |
537 | - uh = skb->h.uh; | |
537 | + uh = udp_hdr(skb); | |
538 | 538 | uh->source = fl->fl_ip_sport; |
539 | 539 | uh->dest = fl->fl_ip_dport; |
540 | 540 | uh->len = htons(up->len); |
net/rxrpc/connection.c
... | ... | @@ -229,10 +229,10 @@ |
229 | 229 | _enter("%p{{%hu}},%u,%hu", |
230 | 230 | peer, |
231 | 231 | peer->trans->port, |
232 | - ntohs(pkt->h.uh->source), | |
232 | + ntohs(udp_hdr(pkt)->source), | |
233 | 233 | ntohs(msg->hdr.serviceId)); |
234 | 234 | |
235 | - x_port = pkt->h.uh->source; | |
235 | + x_port = udp_hdr(pkt)->source; | |
236 | 236 | x_epoch = msg->hdr.epoch; |
237 | 237 | x_clflag = msg->hdr.flags & RXRPC_CLIENT_INITIATED; |
238 | 238 | x_connid = htonl(ntohl(msg->hdr.cid) & RXRPC_CIDMASK); |
net/rxrpc/transport.c
... | ... | @@ -479,7 +479,7 @@ |
479 | 479 | } |
480 | 480 | |
481 | 481 | addr = ip_hdr(pkt)->saddr; |
482 | - port = pkt->h.uh->source; | |
482 | + port = udp_hdr(pkt)->source; | |
483 | 483 | |
484 | 484 | _net("Rx Received UDP packet from %08x:%04hu", |
485 | 485 | ntohl(addr), ntohs(port)); |
... | ... | @@ -625,7 +625,7 @@ |
625 | 625 | |
626 | 626 | memset(&sin,0,sizeof(sin)); |
627 | 627 | sin.sin_family = AF_INET; |
628 | - sin.sin_port = msg->pkt->h.uh->source; | |
628 | + sin.sin_port = udp_hdr(msg->pkt)->source; | |
629 | 629 | sin.sin_addr.s_addr = ip_hdr(msg->pkt)->saddr; |
630 | 630 | |
631 | 631 | msghdr.msg_name = &sin; |