mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-06 12:45:13 +02:00
xt_psd: compact temporary skb buffers
This commit is contained in:
@@ -105,8 +105,10 @@ xt_psd_match(const struct sk_buff *pskb, struct xt_action_param *match)
|
|||||||
const struct iphdr *iph;
|
const struct iphdr *iph;
|
||||||
const struct tcphdr *tcph;
|
const struct tcphdr *tcph;
|
||||||
const struct udphdr *udph;
|
const struct udphdr *udph;
|
||||||
struct tcphdr _tcph;
|
union {
|
||||||
struct udphdr _udph;
|
struct tcphdr tcph;
|
||||||
|
struct udphdr udph;
|
||||||
|
} _buf;
|
||||||
struct in_addr addr;
|
struct in_addr addr;
|
||||||
u_int16_t src_port,dest_port;
|
u_int16_t src_port,dest_port;
|
||||||
u_int8_t tcp_flags, proto;
|
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) {
|
if (proto == IPPROTO_TCP) {
|
||||||
tcph = skb_header_pointer(pskb, match->thoff,
|
tcph = skb_header_pointer(pskb, match->thoff,
|
||||||
sizeof(_tcph), &_tcph);
|
sizeof(_buf.tcph), &_buf.tcph);
|
||||||
if (tcph == NULL)
|
if (tcph == NULL)
|
||||||
return false;
|
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);
|
tcp_flags = *((u_int8_t*)tcph + 13);
|
||||||
} else if (proto == IPPROTO_UDP || proto == IPPROTO_UDPLITE) {
|
} else if (proto == IPPROTO_UDP || proto == IPPROTO_UDPLITE) {
|
||||||
udph = skb_header_pointer(pskb, match->thoff,
|
udph = skb_header_pointer(pskb, match->thoff,
|
||||||
sizeof(_udph), &_udph);
|
sizeof(_buf.udph), &_buf.udph);
|
||||||
if (udph == NULL)
|
if (udph == NULL)
|
||||||
return false;
|
return false;
|
||||||
src_port = udph->source;
|
src_port = udph->source;
|
||||||
|
Reference in New Issue
Block a user