[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>
This commit is contained in:
committed by
David S. Miller
parent
89e7e57778
commit
9b42078ed6
@ -88,11 +88,9 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
|
||||
return -EPROTO;
|
||||
}
|
||||
|
||||
skb->h.raw = skb_push(skb, dccp_header_size);
|
||||
dh = dccp_hdr(skb);
|
||||
|
||||
/* Build DCCP header and checksum it. */
|
||||
memset(dh, 0, dccp_header_size);
|
||||
dh = dccp_zeroed_hdr(skb, dccp_header_size);
|
||||
dh->dccph_type = dcb->dccpd_type;
|
||||
dh->dccph_sport = inet->sport;
|
||||
dh->dccph_dport = inet->dport;
|
||||
@ -340,10 +338,7 @@ struct sk_buff *dccp_make_response(struct sock *sk, struct dst_entry *dst,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
skb->h.raw = skb_push(skb, dccp_header_size);
|
||||
|
||||
dh = dccp_hdr(skb);
|
||||
memset(dh, 0, dccp_header_size);
|
||||
dh = dccp_zeroed_hdr(skb, dccp_header_size);
|
||||
|
||||
dh->dccph_sport = inet_sk(sk)->sport;
|
||||
dh->dccph_dport = inet_rsk(req)->rmt_port;
|
||||
@ -392,10 +387,7 @@ static struct sk_buff *dccp_make_reset(struct sock *sk, struct dst_entry *dst,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
skb->h.raw = skb_push(skb, dccp_header_size);
|
||||
|
||||
dh = dccp_hdr(skb);
|
||||
memset(dh, 0, dccp_header_size);
|
||||
dh = dccp_zeroed_hdr(skb, dccp_header_size);
|
||||
|
||||
dh->dccph_sport = inet_sk(sk)->sport;
|
||||
dh->dccph_dport = inet_sk(sk)->dport;
|
||||
|
Reference in New Issue
Block a user