xt_psd: compact temporary skb buffers

This commit is contained in:
Jan Engelhardt
2011-08-11 15:49:40 +02:00
parent a141cc311c
commit 071c95b750

View File

@@ -105,8 +105,10 @@ xt_psd_match(const struct sk_buff *pskb, struct xt_action_param *match)
const struct iphdr *iph;
const struct tcphdr *tcph;
const struct udphdr *udph;
struct tcphdr _tcph;
struct udphdr _udph;
union {
struct tcphdr tcph;
struct udphdr udph;
} _buf;
struct in_addr addr;
u_int16_t src_port,dest_port;
u_int8_t tcp_flags, proto;
@@ -139,7 +141,7 @@ xt_psd_match(const struct sk_buff *pskb, struct xt_action_param *match)
if (proto == IPPROTO_TCP) {
tcph = skb_header_pointer(pskb, match->thoff,
sizeof(_tcph), &_tcph);
sizeof(_buf.tcph), &_buf.tcph);
if (tcph == NULL)
return false;
@@ -149,7 +151,7 @@ xt_psd_match(const struct sk_buff *pskb, struct xt_action_param *match)
tcp_flags = *((u_int8_t*)tcph + 13);
} else if (proto == IPPROTO_UDP || proto == IPPROTO_UDPLITE) {
udph = skb_header_pointer(pskb, match->thoff,
sizeof(_udph), &_udph);
sizeof(_buf.udph), &_buf.udph);
if (udph == NULL)
return false;
src_port = udph->source;