diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-03-13 13:28:48 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:25:22 -0400 |
commit | 4bedb45203eab92a87b4c863fe2d0cded633427f (patch) | |
tree | d46e43d0a08253cf85ee2db64df6aee5e4ff5a07 /net | |
parent | d9edf9e2be0f7661558984c32bd53867a7037fd3 (diff) |
[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>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/netpoll.c | 4 | ||||
-rw-r--r-- | net/core/pktgen.c | 4 | ||||
-rw-r--r-- | net/ipv4/udp.c | 12 | ||||
-rw-r--r-- | net/ipv6/udp.c | 10 | ||||
-rw-r--r-- | net/rxrpc/connection.c | 4 | ||||
-rw-r--r-- | net/rxrpc/transport.c | 4 |
6 files changed, 20 insertions, 18 deletions
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 8b22723d6436..57a82445c465 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
@@ -296,7 +296,9 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len) | |||
296 | memcpy(skb->data, msg, len); | 296 | memcpy(skb->data, msg, len); |
297 | skb->len += len; | 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 | udph->source = htons(np->local_port); | 302 | udph->source = htons(np->local_port); |
301 | udph->dest = htons(np->remote_port); | 303 | udph->dest = htons(np->remote_port); |
302 | udph->len = htons(udp_len); | 304 | udph->len = htons(udp_len); |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index ee82364c8f31..160d4f01c46e 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -2392,7 +2392,7 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, | |||
2392 | skb->dev = odev; | 2392 | skb->dev = odev; |
2393 | skb->pkt_type = PACKET_HOST; | 2393 | skb->pkt_type = PACKET_HOST; |
2394 | skb->nh.raw = (unsigned char *)iph; | 2394 | skb->nh.raw = (unsigned char *)iph; |
2395 | skb->h.uh = udph; | 2395 | skb->h.raw = (unsigned char *)udph; |
2396 | 2396 | ||
2397 | if (pkt_dev->nfrags <= 0) | 2397 | if (pkt_dev->nfrags <= 0) |
2398 | pgh = (struct pktgen_hdr *)skb_put(skb, datalen); | 2398 | pgh = (struct pktgen_hdr *)skb_put(skb, datalen); |
@@ -2737,7 +2737,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, | |||
2737 | skb->dev = odev; | 2737 | skb->dev = odev; |
2738 | skb->pkt_type = PACKET_HOST; | 2738 | skb->pkt_type = PACKET_HOST; |
2739 | skb->nh.raw = (unsigned char *)iph; | 2739 | skb->nh.raw = (unsigned char *)iph; |
2740 | skb->h.uh = udph; | 2740 | skb->h.raw = (unsigned char *)udph; |
2741 | 2741 | ||
2742 | if (pkt_dev->nfrags <= 0) | 2742 | if (pkt_dev->nfrags <= 0) |
2743 | pgh = (struct pktgen_hdr *)skb_put(skb, datalen); | 2743 | pgh = (struct pktgen_hdr *)skb_put(skb, datalen); |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 13875e8419a7..926404c5e58c 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -420,7 +420,7 @@ static void udp4_hwcsum_outgoing(struct sock *sk, struct sk_buff *skb, | |||
420 | __be32 src, __be32 dst, int len ) | 420 | __be32 src, __be32 dst, int len ) |
421 | { | 421 | { |
422 | unsigned int offset; | 422 | unsigned int offset; |
423 | struct udphdr *uh = skb->h.uh; | 423 | struct udphdr *uh = udp_hdr(skb); |
424 | __wsum csum = 0; | 424 | __wsum csum = 0; |
425 | 425 | ||
426 | if (skb_queue_len(&sk->sk_write_queue) == 1) { | 426 | if (skb_queue_len(&sk->sk_write_queue) == 1) { |
@@ -470,7 +470,7 @@ static int udp_push_pending_frames(struct sock *sk) | |||
470 | /* | 470 | /* |
471 | * Create a UDP header | 471 | * Create a UDP header |
472 | */ | 472 | */ |
473 | uh = skb->h.uh; | 473 | uh = udp_hdr(skb); |
474 | uh->source = fl->fl_ip_sport; | 474 | uh->source = fl->fl_ip_sport; |
475 | uh->dest = fl->fl_ip_dport; | 475 | uh->dest = fl->fl_ip_dport; |
476 | uh->len = htons(up->len); | 476 | uh->len = htons(up->len); |
@@ -866,7 +866,7 @@ try_again: | |||
866 | if (sin) | 866 | if (sin) |
867 | { | 867 | { |
868 | sin->sin_family = AF_INET; | 868 | sin->sin_family = AF_INET; |
869 | sin->sin_port = skb->h.uh->source; | 869 | sin->sin_port = udp_hdr(skb)->source; |
870 | sin->sin_addr.s_addr = ip_hdr(skb)->saddr; | 870 | sin->sin_addr.s_addr = ip_hdr(skb)->saddr; |
871 | memset(sin->sin_zero, 0, sizeof(sin->sin_zero)); | 871 | memset(sin->sin_zero, 0, sizeof(sin->sin_zero)); |
872 | } | 872 | } |
@@ -949,7 +949,7 @@ static int udp_encap_rcv(struct sock * sk, struct sk_buff *skb) | |||
949 | return 1; | 949 | return 1; |
950 | 950 | ||
951 | /* Now we can get the pointers */ | 951 | /* Now we can get the pointers */ |
952 | uh = skb->h.uh; | 952 | uh = udp_hdr(skb); |
953 | udpdata = (__u8 *)uh + sizeof(struct udphdr); | 953 | udpdata = (__u8 *)uh + sizeof(struct udphdr); |
954 | udpdata32 = (__be32 *)udpdata; | 954 | udpdata32 = (__be32 *)udpdata; |
955 | 955 | ||
@@ -1207,7 +1207,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[], | |||
1207 | int proto) | 1207 | int proto) |
1208 | { | 1208 | { |
1209 | struct sock *sk; | 1209 | struct sock *sk; |
1210 | struct udphdr *uh = skb->h.uh; | 1210 | struct udphdr *uh = udp_hdr(skb); |
1211 | unsigned short ulen; | 1211 | unsigned short ulen; |
1212 | struct rtable *rt = (struct rtable*)skb->dst; | 1212 | struct rtable *rt = (struct rtable*)skb->dst; |
1213 | __be32 saddr = ip_hdr(skb)->saddr; | 1213 | __be32 saddr = ip_hdr(skb)->saddr; |
@@ -1227,7 +1227,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[], | |||
1227 | /* UDP validates ulen. */ | 1227 | /* UDP validates ulen. */ |
1228 | if (ulen < sizeof(*uh) || pskb_trim_rcsum(skb, ulen)) | 1228 | if (ulen < sizeof(*uh) || pskb_trim_rcsum(skb, ulen)) |
1229 | goto short_packet; | 1229 | goto short_packet; |
1230 | uh = skb->h.uh; | 1230 | uh = udp_hdr(skb); |
1231 | } | 1231 | } |
1232 | 1232 | ||
1233 | if (udp4_csum_init(skb, uh, proto)) | 1233 | if (udp4_csum_init(skb, uh, proto)) |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 55affe39b2eb..1e3dfb20b1cf 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -172,7 +172,7 @@ try_again: | |||
172 | 172 | ||
173 | sin6 = (struct sockaddr_in6 *) msg->msg_name; | 173 | sin6 = (struct sockaddr_in6 *) msg->msg_name; |
174 | sin6->sin6_family = AF_INET6; | 174 | sin6->sin6_family = AF_INET6; |
175 | sin6->sin6_port = skb->h.uh->source; | 175 | sin6->sin6_port = udp_hdr(skb)->source; |
176 | sin6->sin6_flowinfo = 0; | 176 | sin6->sin6_flowinfo = 0; |
177 | sin6->sin6_scope_id = 0; | 177 | sin6->sin6_scope_id = 0; |
178 | 178 | ||
@@ -346,7 +346,7 @@ static int __udp6_lib_mcast_deliver(struct sk_buff *skb, struct in6_addr *saddr, | |||
346 | struct in6_addr *daddr, struct hlist_head udptable[]) | 346 | struct in6_addr *daddr, struct hlist_head udptable[]) |
347 | { | 347 | { |
348 | struct sock *sk, *sk2; | 348 | struct sock *sk, *sk2; |
349 | const struct udphdr *uh = skb->h.uh; | 349 | const struct udphdr *uh = udp_hdr(skb); |
350 | int dif; | 350 | int dif; |
351 | 351 | ||
352 | read_lock(&udp_hash_lock); | 352 | read_lock(&udp_hash_lock); |
@@ -420,7 +420,7 @@ int __udp6_lib_rcv(struct sk_buff **pskb, struct hlist_head udptable[], | |||
420 | 420 | ||
421 | saddr = &ipv6_hdr(skb)->saddr; | 421 | saddr = &ipv6_hdr(skb)->saddr; |
422 | daddr = &ipv6_hdr(skb)->daddr; | 422 | daddr = &ipv6_hdr(skb)->daddr; |
423 | uh = skb->h.uh; | 423 | uh = udp_hdr(skb); |
424 | 424 | ||
425 | ulen = ntohs(uh->len); | 425 | ulen = ntohs(uh->len); |
426 | if (ulen > skb->len) | 426 | if (ulen > skb->len) |
@@ -441,7 +441,7 @@ int __udp6_lib_rcv(struct sk_buff **pskb, struct hlist_head udptable[], | |||
441 | goto short_packet; | 441 | goto short_packet; |
442 | saddr = &ipv6_hdr(skb)->saddr; | 442 | saddr = &ipv6_hdr(skb)->saddr; |
443 | daddr = &ipv6_hdr(skb)->daddr; | 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 @@ static int udp_v6_push_pending_frames(struct sock *sk) | |||
534 | /* | 534 | /* |
535 | * Create a UDP header | 535 | * Create a UDP header |
536 | */ | 536 | */ |
537 | uh = skb->h.uh; | 537 | uh = udp_hdr(skb); |
538 | uh->source = fl->fl_ip_sport; | 538 | uh->source = fl->fl_ip_sport; |
539 | uh->dest = fl->fl_ip_dport; | 539 | uh->dest = fl->fl_ip_dport; |
540 | uh->len = htons(up->len); | 540 | uh->len = htons(up->len); |
diff --git a/net/rxrpc/connection.c b/net/rxrpc/connection.c index e601fa87bb77..665a99952440 100644 --- a/net/rxrpc/connection.c +++ b/net/rxrpc/connection.c | |||
@@ -229,10 +229,10 @@ int rxrpc_connection_lookup(struct rxrpc_peer *peer, | |||
229 | _enter("%p{{%hu}},%u,%hu", | 229 | _enter("%p{{%hu}},%u,%hu", |
230 | peer, | 230 | peer, |
231 | peer->trans->port, | 231 | peer->trans->port, |
232 | ntohs(pkt->h.uh->source), | 232 | ntohs(udp_hdr(pkt)->source), |
233 | ntohs(msg->hdr.serviceId)); | 233 | ntohs(msg->hdr.serviceId)); |
234 | 234 | ||
235 | x_port = pkt->h.uh->source; | 235 | x_port = udp_hdr(pkt)->source; |
236 | x_epoch = msg->hdr.epoch; | 236 | x_epoch = msg->hdr.epoch; |
237 | x_clflag = msg->hdr.flags & RXRPC_CLIENT_INITIATED; | 237 | x_clflag = msg->hdr.flags & RXRPC_CLIENT_INITIATED; |
238 | x_connid = htonl(ntohl(msg->hdr.cid) & RXRPC_CIDMASK); | 238 | x_connid = htonl(ntohl(msg->hdr.cid) & RXRPC_CIDMASK); |
diff --git a/net/rxrpc/transport.c b/net/rxrpc/transport.c index cac078b74068..62398fd01f85 100644 --- a/net/rxrpc/transport.c +++ b/net/rxrpc/transport.c | |||
@@ -479,7 +479,7 @@ void rxrpc_trans_receive_packet(struct rxrpc_transport *trans) | |||
479 | } | 479 | } |
480 | 480 | ||
481 | addr = ip_hdr(pkt)->saddr; | 481 | addr = ip_hdr(pkt)->saddr; |
482 | port = pkt->h.uh->source; | 482 | port = udp_hdr(pkt)->source; |
483 | 483 | ||
484 | _net("Rx Received UDP packet from %08x:%04hu", | 484 | _net("Rx Received UDP packet from %08x:%04hu", |
485 | ntohl(addr), ntohs(port)); | 485 | ntohl(addr), ntohs(port)); |
@@ -625,7 +625,7 @@ int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans, | |||
625 | 625 | ||
626 | memset(&sin,0,sizeof(sin)); | 626 | memset(&sin,0,sizeof(sin)); |
627 | sin.sin_family = AF_INET; | 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 | sin.sin_addr.s_addr = ip_hdr(msg->pkt)->saddr; | 629 | sin.sin_addr.s_addr = ip_hdr(msg->pkt)->saddr; |
630 | 630 | ||
631 | msghdr.msg_name = &sin; | 631 | msghdr.msg_name = &sin; |