Commit 412c4022 authored by David S. Miller's avatar David S. Miller

[NETFILTER IPV6]: Fix warnings.

parent ed3abd85
...@@ -19,13 +19,6 @@ MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>"); ...@@ -19,13 +19,6 @@ MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>");
#define DEBUGP(format, args...) #define DEBUGP(format, args...)
#endif #endif
struct ahhdr {
__u8 nexthdr;
__u8 hdrlen;
__u16 reserved;
__u32 spi;
};
/* Returns 1 if the spi is matched by the range, 0 otherwise */ /* Returns 1 if the spi is matched by the range, 0 otherwise */
static inline int static inline int
spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, int invert) spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, int invert)
...@@ -48,7 +41,7 @@ match(const struct sk_buff *skb, ...@@ -48,7 +41,7 @@ match(const struct sk_buff *skb,
u_int16_t datalen, u_int16_t datalen,
int *hotdrop) int *hotdrop)
{ {
struct ahhdr *ah = NULL; struct ip_auth_hdr *ah = NULL;
const struct ip6t_ah *ahinfo = matchinfo; const struct ip6t_ah *ahinfo = matchinfo;
unsigned int temp; unsigned int temp;
int len; int len;
...@@ -128,12 +121,12 @@ match(const struct sk_buff *skb, ...@@ -128,12 +121,12 @@ match(const struct sk_buff *skb,
/* AH header not found */ /* AH header not found */
if ( temp != MASK_AH ) return 0; if ( temp != MASK_AH ) return 0;
if (len < (int)sizeof(struct ahhdr)){ if (len < (int)sizeof(struct ip_auth_hdr)){
*hotdrop = 1; *hotdrop = 1;
return 0; return 0;
} }
ah=skb->data+ptr; ah = (struct ip_auth_hdr *) (skb->data + ptr);
DEBUGP("IPv6 AH LEN %u %u ", hdrlen, ah->hdrlen); DEBUGP("IPv6 AH LEN %u %u ", hdrlen, ah->hdrlen);
DEBUGP("RES %04X ", ah->reserved); DEBUGP("RES %04X ", ah->reserved);
......
...@@ -19,10 +19,6 @@ MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>"); ...@@ -19,10 +19,6 @@ MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>");
#define DEBUGP(format, args...) #define DEBUGP(format, args...)
#endif #endif
struct esphdr {
__u32 spi;
};
/* Returns 1 if the spi is matched by the range, 0 otherwise */ /* Returns 1 if the spi is matched by the range, 0 otherwise */
static inline int static inline int
spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, int invert) spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, int invert)
...@@ -45,7 +41,7 @@ match(const struct sk_buff *skb, ...@@ -45,7 +41,7 @@ match(const struct sk_buff *skb,
u_int16_t datalen, u_int16_t datalen,
int *hotdrop) int *hotdrop)
{ {
struct esphdr *esp = NULL; struct ip_esp_hdr *esp = NULL;
const struct ip6t_esp *espinfo = matchinfo; const struct ip6t_esp *espinfo = matchinfo;
unsigned int temp; unsigned int temp;
int len; int len;
...@@ -118,12 +114,12 @@ match(const struct sk_buff *skb, ...@@ -118,12 +114,12 @@ match(const struct sk_buff *skb,
/* ESP header not found */ /* ESP header not found */
if ( temp != MASK_ESP ) return 0; if ( temp != MASK_ESP ) return 0;
if (len < (int)sizeof(struct esphdr)){ if (len < (int)sizeof(struct ip_esp_hdr)){
*hotdrop = 1; *hotdrop = 1;
return 0; return 0;
} }
esp=skb->data+ptr; esp = (struct ip_esp_hdr *) (skb->data + ptr);
DEBUGP("IPv6 ESP SPI %u %08X\n", ntohl(esp->spi), ntohl(esp->spi)); DEBUGP("IPv6 ESP SPI %u %08X\n", ntohl(esp->spi), ntohl(esp->spi));
......
...@@ -147,7 +147,7 @@ match(const struct sk_buff *skb, ...@@ -147,7 +147,7 @@ match(const struct sk_buff *skb,
return 0; return 0;
} }
frag=skb->data+ptr; frag = (struct fraghdr *) (skb->data + ptr);
DEBUGP("IPv6 FRAG LEN %u %u ", hdrlen, frag->hdrlen); DEBUGP("IPv6 FRAG LEN %u %u ", hdrlen, frag->hdrlen);
DEBUGP("INFO %04X ", frag->info); DEBUGP("INFO %04X ", frag->info);
......
...@@ -18,12 +18,6 @@ MODULE_LICENSE("GPL"); ...@@ -18,12 +18,6 @@ MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("IPv6 headers match"); MODULE_DESCRIPTION("IPv6 headers match");
MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>"); MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>");
#if 0
#define DEBUGP printk
#else
#define DEBUGP(format, args...)
#endif
static int static int
ipv6header_match(const struct sk_buff *skb, ipv6header_match(const struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
...@@ -39,10 +33,8 @@ ipv6header_match(const struct sk_buff *skb, ...@@ -39,10 +33,8 @@ ipv6header_match(const struct sk_buff *skb,
int len; int len;
u8 nexthdr; u8 nexthdr;
unsigned int ptr; unsigned int ptr;
struct inet6_skb_parm *opt = (struct inet6_skb_parm *)skb->cb;
/* Make sure this isn't an evil packet */ /* Make sure this isn't an evil packet */
DEBUGP("ipv6_header entered \n");
/* type of the 1st exthdr */ /* type of the 1st exthdr */
nexthdr = skb->nh.ipv6h->nexthdr; nexthdr = skb->nh.ipv6h->nexthdr;
...@@ -52,44 +44,10 @@ ipv6header_match(const struct sk_buff *skb, ...@@ -52,44 +44,10 @@ ipv6header_match(const struct sk_buff *skb,
len = skb->len - ptr; len = skb->len - ptr;
temp = 0; temp = 0;
DEBUGP("ipv6_header nexthdr %02X \n",nexthdr);
DEBUGP("ipv6_header ptr %08X \n",ptr);
DEBUGP("ipv6_header skblen %04X \n",skb->len);
DEBUGP("ipv6_header skbdatalen %04X \n",skb->data_len);
DEBUGP("ipv6_header len %04X \n",len);
#if 0
for (temp=0;temp<skb->len;temp++){
if (!(temp % 16 )) DEBUGP("\nipv6_header data ");
DEBUGP("%02X ",skb->data[temp]);
}
#endif
DEBUGP("\nipv6_header h.raw %02X %02X %02X %02X \n",
skb->h.raw[0],
skb->h.raw[1],
skb->h.raw[2],
skb->h.raw[3]);
DEBUGP("ipv6_header nh.raw %02X %02X %02X %02X \n",
skb->nh.raw[0],
skb->nh.raw[1],
skb->nh.raw[2],
skb->nh.raw[3]);
DEBUGP("ipv6_header CB %02X %02X %02X %02X %02X %02X %02X \n",
opt->iif,
opt->ra,
opt->hop,
opt->auth,
opt->dst0,
opt->srcrt,
opt->dst1);
temp = 0;
while (ip6t_ext_hdr(nexthdr)) { while (ip6t_ext_hdr(nexthdr)) {
struct ipv6_opt_hdr *hdr; struct ipv6_opt_hdr *hdr;
int hdrlen; int hdrlen;
DEBUGP("ipv6_header header iteration \n");
/* Is there enough space for the next ext header? */ /* Is there enough space for the next ext header? */
if (len < (int)sizeof(struct ipv6_opt_hdr)) if (len < (int)sizeof(struct ipv6_opt_hdr))
return 0; return 0;
...@@ -114,8 +72,6 @@ ipv6header_match(const struct sk_buff *skb, ...@@ -114,8 +72,6 @@ ipv6header_match(const struct sk_buff *skb,
else else
hdrlen = ipv6_optlen(hdr); hdrlen = ipv6_optlen(hdr);
DEBUGP("ipv6_header hdrlen %04X \n",hdrlen);
/* set the flag */ /* set the flag */
switch (nexthdr){ switch (nexthdr){
case NEXTHDR_HOP: case NEXTHDR_HOP:
...@@ -134,7 +90,6 @@ ipv6header_match(const struct sk_buff *skb, ...@@ -134,7 +90,6 @@ ipv6header_match(const struct sk_buff *skb,
temp |= MASK_DSTOPTS; temp |= MASK_DSTOPTS;
break; break;
default: default:
DEBUGP("IPV6HEADER match: unknown nextheader %u\n",nexthdr);
return 0; return 0;
break; break;
} }
...@@ -142,17 +97,13 @@ ipv6header_match(const struct sk_buff *skb, ...@@ -142,17 +97,13 @@ ipv6header_match(const struct sk_buff *skb,
nexthdr = hdr->nexthdr; nexthdr = hdr->nexthdr;
len -= hdrlen; len -= hdrlen;
ptr += hdrlen; ptr += hdrlen;
if ( ptr > skb->len ) { if (ptr > skb->len)
DEBUGP("ipv6_header new ptr %04X \n",ptr);
break; break;
} }
}
if ( (nexthdr != NEXTHDR_NONE ) && (nexthdr != NEXTHDR_ESP) ) if ( (nexthdr != NEXTHDR_NONE ) && (nexthdr != NEXTHDR_ESP) )
temp |= MASK_PROTO; temp |= MASK_PROTO;
DEBUGP ("ipv6header: %02X %02X \n", temp, info->matchflags);
if (info->modeflag) if (info->modeflag)
return (!( (temp & info->matchflags) return (!( (temp & info->matchflags)
^ info->matchflags) ^ info->invflags); ^ info->matchflags) ^ info->invflags);
...@@ -169,11 +120,8 @@ ipv6header_checkentry(const char *tablename, ...@@ -169,11 +120,8 @@ ipv6header_checkentry(const char *tablename,
{ {
/* Check for obvious errors */ /* Check for obvious errors */
/* This match is valid in all hooks! */ /* This match is valid in all hooks! */
if (matchsize != IP6T_ALIGN(sizeof(struct ip6t_ipv6header_info))) { if (matchsize != IP6T_ALIGN(sizeof(struct ip6t_ipv6header_info)))
DEBUGP("ip6t_ipv6header: matchsize != %u\n",
IP6T_ALIGN(sizeof(struct ip6t_ipv6header_info)));
return 0; return 0;
}
return 1; return 1;
} }
......
...@@ -130,7 +130,7 @@ match(const struct sk_buff *skb, ...@@ -130,7 +130,7 @@ match(const struct sk_buff *skb,
return 0; return 0;
} }
route=skb->data+ptr; route = (struct ipv6_rt_hdr *) (skb->data + ptr);
DEBUGP("IPv6 RT LEN %u %u ", hdrlen, route->hdrlen); DEBUGP("IPv6 RT LEN %u %u ", hdrlen, route->hdrlen);
DEBUGP("TYPE %04X ", route->type); DEBUGP("TYPE %04X ", route->type);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment