From 071c95b7506cb30d365544d22d3261d1048e2d7f Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Thu, 11 Aug 2011 15:49:40 +0200 Subject: [PATCH] xt_psd: compact temporary skb buffers --- extensions/xt_psd.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/extensions/xt_psd.c b/extensions/xt_psd.c index 63ba586..04d1453 100644 --- a/extensions/xt_psd.c +++ b/extensions/xt_psd.c @@ -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;