[NETFILTER]: nf_conntrack: introduce expectation classes and policies
[deliverable/linux.git] / net / ipv4 / netfilter / nf_nat_snmp_basic.c
index 03709d6b4b060d76e3006c40658a9cd3096955d7..000e080bac5c49ec35541cee0f8d93ebf4779452 100644 (file)
@@ -50,6 +50,7 @@
 #include <net/udp.h>
 
 #include <net/netfilter/nf_nat.h>
+#include <net/netfilter/nf_conntrack_expect.h>
 #include <net/netfilter/nf_conntrack_helper.h>
 #include <net/netfilter/nf_nat_helper.h>
 
@@ -60,7 +61,7 @@ MODULE_ALIAS("ip_nat_snmp_basic");
 
 #define SNMP_PORT 161
 #define SNMP_TRAP_PORT 162
-#define NOCT1(n) (*(u8 *)n)
+#define NOCT1(n) (*(u8 *)(n))
 
 static int debug;
 static DEFINE_SPINLOCK(snmp_lock);
@@ -260,7 +261,7 @@ static unsigned char asn1_eoc_decode(struct asn1_ctx *ctx, unsigned char *eoc)
 {
        unsigned char ch;
 
-       if (eoc == 0) {
+       if (eoc == NULL) {
                if (!asn1_octet_decode(ctx, &ch))
                        return 0;
 
@@ -1267,11 +1268,15 @@ static int help(struct sk_buff *skb, unsigned int protoff,
        return ret;
 }
 
+static const struct nf_conntrack_expect_policy snmp_exp_policy = {
+       .max_expected   = 0,
+       .timeout        = 180,
+};
+
 static struct nf_conntrack_helper snmp_helper __read_mostly = {
-       .max_expected           = 0,
-       .timeout                = 180,
        .me                     = THIS_MODULE,
        .help                   = help,
+       .expect_policy          = &snmp_exp_policy,
        .name                   = "snmp",
        .tuple.src.l3num        = AF_INET,
        .tuple.src.u.udp.port   = __constant_htons(SNMP_PORT),
@@ -1279,10 +1284,9 @@ static struct nf_conntrack_helper snmp_helper __read_mostly = {
 };
 
 static struct nf_conntrack_helper snmp_trap_helper __read_mostly = {
-       .max_expected           = 0,
-       .timeout                = 180,
        .me                     = THIS_MODULE,
        .help                   = help,
+       .expect_policy          = &snmp_exp_policy,
        .name                   = "snmp_trap",
        .tuple.src.l3num        = AF_INET,
        .tuple.src.u.udp.port   = __constant_htons(SNMP_TRAP_PORT),
This page took 0.030161 seconds and 5 git commands to generate.