diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2006-11-10 08:22:32 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:21:55 -0500 |
commit | 9b42078ed6edfe04e9dc9a59b946ad912aeef717 (patch) | |
tree | d3d20e17aa85e1bb16b99397f98f151d197b3177 /net/dccp/ipv6.c | |
parent | 89e7e57778ecd8744fee97491300f05a9fb1388a (diff) |
[DCCP]: Combine allocating & zeroing header space on skb
This is a code simplification:
it combines three often recurring operations into one inline function,
* allocate `len' bytes header space in skb
* fill these `len' bytes with zeroes
* cast the start of this header space as dccp_hdr
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net/dccp/ipv6.c')
-rw-r--r-- | net/dccp/ipv6.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index 6f1c2ad88608..116bddb64b80 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -537,9 +537,7 @@ static void dccp_v6_ctl_send_reset(struct sk_buff *rxskb) | |||
537 | 537 | ||
538 | skb_reserve(skb, dccp_v6_ctl_socket->sk->sk_prot->max_header); | 538 | skb_reserve(skb, dccp_v6_ctl_socket->sk->sk_prot->max_header); |
539 | 539 | ||
540 | skb->h.raw = skb_push(skb, dccp_hdr_reset_len); | 540 | dh = dccp_zeroed_hdr(skb, dccp_hdr_reset_len); |
541 | dh = dccp_hdr(skb); | ||
542 | memset(dh, 0, dccp_hdr_reset_len); | ||
543 | 541 | ||
544 | /* Swap the send and the receive. */ | 542 | /* Swap the send and the receive. */ |
545 | dh->dccph_type = DCCP_PKT_RESET; | 543 | dh->dccph_type = DCCP_PKT_RESET; |
@@ -601,9 +599,7 @@ static void dccp_v6_reqsk_send_ack(struct sk_buff *rxskb, | |||
601 | 599 | ||
602 | skb_reserve(skb, dccp_v6_ctl_socket->sk->sk_prot->max_header); | 600 | skb_reserve(skb, dccp_v6_ctl_socket->sk->sk_prot->max_header); |
603 | 601 | ||
604 | skb->h.raw = skb_push(skb, dccp_hdr_ack_len); | 602 | dh = dccp_zeroed_hdr(skb, dccp_hdr_ack_len); |
605 | dh = dccp_hdr(skb); | ||
606 | memset(dh, 0, dccp_hdr_ack_len); | ||
607 | 603 | ||
608 | /* Build DCCP header and checksum it. */ | 604 | /* Build DCCP header and checksum it. */ |
609 | dh->dccph_type = DCCP_PKT_ACK; | 605 | dh->dccph_type = DCCP_PKT_ACK; |