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/ipv4.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/ipv4.c')
-rw-r--r-- | net/dccp/ipv4.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index de64e6c7f93d..ce8eed32dbeb 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -212,12 +212,9 @@ static void dccp_v4_reqsk_send_ack(struct sk_buff *rxskb, | |||
212 | 212 | ||
213 | /* Reserve space for headers. */ | 213 | /* Reserve space for headers. */ |
214 | skb_reserve(skb, dccp_v4_ctl_socket->sk->sk_prot->max_header); | 214 | skb_reserve(skb, dccp_v4_ctl_socket->sk->sk_prot->max_header); |
215 | |||
216 | skb->dst = dst_clone(rxskb->dst); | 215 | skb->dst = dst_clone(rxskb->dst); |
217 | 216 | ||
218 | skb->h.raw = skb_push(skb, dccp_hdr_ack_len); | 217 | dh = dccp_zeroed_hdr(skb, dccp_hdr_ack_len); |
219 | dh = dccp_hdr(skb); | ||
220 | memset(dh, 0, dccp_hdr_ack_len); | ||
221 | 218 | ||
222 | /* Build DCCP header and checksum it. */ | 219 | /* Build DCCP header and checksum it. */ |
223 | dh->dccph_type = DCCP_PKT_ACK; | 220 | dh->dccph_type = DCCP_PKT_ACK; |
@@ -720,9 +717,7 @@ static void dccp_v4_ctl_send_reset(struct sk_buff *rxskb) | |||
720 | skb_reserve(skb, dccp_v4_ctl_socket->sk->sk_prot->max_header); | 717 | skb_reserve(skb, dccp_v4_ctl_socket->sk->sk_prot->max_header); |
721 | skb->dst = dst_clone(dst); | 718 | skb->dst = dst_clone(dst); |
722 | 719 | ||
723 | skb->h.raw = skb_push(skb, dccp_hdr_reset_len); | 720 | dh = dccp_zeroed_hdr(skb, dccp_hdr_reset_len); |
724 | dh = dccp_hdr(skb); | ||
725 | memset(dh, 0, dccp_hdr_reset_len); | ||
726 | 721 | ||
727 | /* Build DCCP header and checksum it. */ | 722 | /* Build DCCP header and checksum it. */ |
728 | dh->dccph_type = DCCP_PKT_RESET; | 723 | dh->dccph_type = DCCP_PKT_RESET; |