summaryrefslogtreecommitdiffstats
path: root/sys/netpfil/pf
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2015-02-16 23:50:53 +0000
committerglebius <glebius@FreeBSD.org>2015-02-16 23:50:53 +0000
commit534401756a602da25424e1153fdb06e6bcd61e63 (patch)
tree7d9d86df9b814d7f3a6cdd9bb530ca71953faa01 /sys/netpfil/pf
parentbc75b399e25aab68eef7bf27125e87d46381e409 (diff)
downloadFreeBSD-src-534401756a602da25424e1153fdb06e6bcd61e63.zip
FreeBSD-src-534401756a602da25424e1153fdb06e6bcd61e63.tar.gz
- Improve INET/INET6 scope.
- style(9) declarations. - Make couple of local functions static.
Diffstat (limited to 'sys/netpfil/pf')
-rw-r--r--sys/netpfil/pf/pf_norm.c65
1 files changed, 31 insertions, 34 deletions
diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c
index 5fa53bf..aed2a55 100644
--- a/sys/netpfil/pf/pf_norm.c
+++ b/sys/netpfil/pf/pf_norm.c
@@ -134,35 +134,32 @@ static int pf_frag_compare(struct pf_fragment *,
static RB_PROTOTYPE(pf_frag_tree, pf_fragment, fr_entry, pf_frag_compare);
static RB_GENERATE(pf_frag_tree, pf_fragment, fr_entry, pf_frag_compare);
-/* Private prototypes */
-static void pf_free_fragment(struct pf_fragment *);
-static void pf_remove_fragment(struct pf_fragment *);
-static int pf_normalize_tcpopt(struct pf_rule *, struct mbuf *,
- struct tcphdr *, int, sa_family_t);
+static void pf_free_fragment(struct pf_fragment *);
+static void pf_remove_fragment(struct pf_fragment *);
+static int pf_normalize_tcpopt(struct pf_rule *, struct mbuf *,
+ struct tcphdr *, int, sa_family_t);
+struct pf_frent *pf_create_fragment(u_short *);
+static struct pf_fragment *
+ pf_find_fragment(struct pf_fragment_cmp *key,
+ struct pf_frag_tree *tree);
+static struct pf_fragment *
+ pf_fillup_fragment(struct pf_fragment_cmp *, struct pf_frent *, u_short *);
+static int pf_isfull_fragment(struct pf_fragment *);
+struct mbuf *pf_join_fragment(struct pf_fragment *);
#ifdef INET
-static void pf_scrub_ip(struct mbuf **, u_int32_t, u_int8_t,
- u_int8_t);
-static void pf_flush_fragments(void);
-static struct pf_fragment *pf_find_fragment(struct pf_fragment_cmp *key,
- struct pf_frag_tree *tree);
-struct pf_frent *pf_create_fragment(u_short *);
-static int pf_reassemble(struct mbuf **, struct ip *, int,
- u_short *);
-static struct mbuf *pf_fragcache(struct mbuf **, struct ip*,
- struct pf_fragment **, int, int, int *);
-static struct pf_fragment *pf_fillup_fragment(struct pf_fragment_cmp *,
- struct pf_frent *, u_short *);
-int pf_isfull_fragment(struct pf_fragment *);
-struct mbuf *pf_join_fragment(struct pf_fragment *);
-
-
-#endif /* INET */
+static void pf_scrub_ip(struct mbuf **, uint32_t, uint8_t, uint8_t);
+static void pf_flush_fragments(void);
+static int pf_reassemble(struct mbuf **, struct ip *, int, u_short *);
+static struct mbuf *
+ pf_fragcache(struct mbuf **, struct ip*, struct pf_fragment **,
+ int, int, int *);
+#endif /* INET */
#ifdef INET6
-int pf_reassemble6(struct mbuf **, struct ip6_hdr *,
- struct ip6_frag *, uint16_t, uint16_t, int,
- u_short *);
-static void pf_scrub_ip6(struct mbuf **, u_int8_t);
-#endif
+static int pf_reassemble6(struct mbuf **, struct ip6_hdr *,
+ struct ip6_frag *, uint16_t, uint16_t, int, u_short *);
+static void pf_scrub_ip6(struct mbuf **, uint8_t);
+#endif /* INET6 */
+
#define DPFPRINTF(x) do { \
if (V_pf_status.debug >= PF_DEBUG_MISC) { \
printf("%s: ", __func__); \
@@ -170,6 +167,7 @@ static void pf_scrub_ip6(struct mbuf **, u_int8_t);
} \
} while(0)
+#ifdef INET
static void
pf_ip2key(struct ip *ip, int dir, struct pf_fragment_cmp *key)
{
@@ -181,6 +179,7 @@ pf_ip2key(struct ip *ip, int dir, struct pf_fragment_cmp *key)
key->frc_id = ip->ip_id;
key->frc_direction = dir;
}
+#endif /* INET */
void
pf_normalize_init(void)
@@ -374,7 +373,6 @@ pf_remove_fragment(struct pf_fragment *frag)
}
}
-#ifdef INET
struct pf_frent *
pf_create_fragment(u_short *reason)
{
@@ -538,7 +536,7 @@ drop_fragment:
return (NULL);
}
-int
+static int
pf_isfull_fragment(struct pf_fragment *frag)
{
struct pf_frent *frent, *next;
@@ -603,7 +601,7 @@ pf_join_fragment(struct pf_fragment *frag)
return (m);
}
-#define FR_IP_OFF(fr) ((ntohs((fr)->fr_ip->ip_off) & IP_OFFMASK) << 3)
+#ifdef INET
static int
pf_reassemble(struct mbuf **m0, struct ip *ip, int dir, u_short *reason)
{
@@ -670,9 +668,9 @@ pf_reassemble(struct mbuf **m0, struct ip *ip, int dir, u_short *reason)
}
#ifdef INET6
-int
+static int
pf_reassemble6(struct mbuf **m0, struct ip6_hdr *ip6, struct ip6_frag *fraghdr,
- uint16_t hdrlen, uint16_t extoff, int dir, u_short *reason)
+ uint16_t hdrlen, uint16_t extoff, int dir, u_short *reason)
{
struct mbuf *m = *m0;
struct pf_frent *frent;
@@ -789,8 +787,7 @@ fail:
/* PF_DROP requires a valid mbuf *m0 in pf_test6(), will free later. */
return (PF_DROP);
}
-
-#endif
+#endif /* INET6 */
static struct mbuf *
pf_fragcache(struct mbuf **m0, struct ip *h, struct pf_fragment **frag, int mff,
OpenPOWER on IntegriCloud