]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
[NET] rules: Share common attribute validation policy
authorThomas Graf <tgraf@suug.ch>
Thu, 9 Nov 2006 23:22:48 +0000 (15:22 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 3 Dec 2006 05:21:41 +0000 (21:21 -0800)
Move the attribute policy for the non-specific attributes into
net/fib_rules.h and include it in the respective protocols.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/fib_rules.h
net/decnet/dn_rules.c
net/ipv4/fib_rules.c
net/ipv6/fib6_rules.c

index 68542b565cf75919b22e1c9ea3d873dba4cad951..e4ba781d289f1aba59d7f836eca386a028de3358 100644 (file)
@@ -59,6 +59,13 @@ struct fib_rules_ops
        struct module           *owner;
 };
 
+#define FRA_GENERIC_POLICY \
+       [FRA_IFNAME]    = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \
+       [FRA_PRIORITY]  = { .type = NLA_U32 }, \
+       [FRA_FWMARK]    = { .type = NLA_U32 }, \
+       [FRA_FWMASK]    = { .type = NLA_U32 }, \
+       [FRA_TABLE]     = { .type = NLA_U32 }
+
 static inline void fib_rule_get(struct fib_rule *rule)
 {
        atomic_inc(&rule->refcnt);
index 1f5d23c96681dc0e8e553b070fd3da8d60bde49e..e32d0c3d5a96a3e3ec5b040ef4b1d365e68b4125 100644 (file)
@@ -108,13 +108,9 @@ errout:
 }
 
 static struct nla_policy dn_fib_rule_policy[FRA_MAX+1] __read_mostly = {
-       [FRA_IFNAME]    = { .type = NLA_STRING, .len = IFNAMSIZ - 1 },
-       [FRA_PRIORITY]  = { .type = NLA_U32 },
+       FRA_GENERIC_POLICY,
        [FRA_SRC]       = { .type = NLA_U16 },
        [FRA_DST]       = { .type = NLA_U16 },
-       [FRA_FWMARK]    = { .type = NLA_U32 },
-       [FRA_FWMASK]    = { .type = NLA_U32 },
-       [FRA_TABLE]     = { .type = NLA_U32 },
 };
 
 static int dn_fib_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
index d2a190a35d65f962147e67e78d926aa44167e442..fd4a8cd4c06eeaf8ee64f410f7aa5c636509d2ba 100644 (file)
@@ -170,14 +170,10 @@ static struct fib_table *fib_empty_table(void)
 }
 
 static struct nla_policy fib4_rule_policy[FRA_MAX+1] __read_mostly = {
-       [FRA_IFNAME]    = { .type = NLA_STRING, .len = IFNAMSIZ - 1 },
-       [FRA_PRIORITY]  = { .type = NLA_U32 },
+       FRA_GENERIC_POLICY,
        [FRA_SRC]       = { .type = NLA_U32 },
        [FRA_DST]       = { .type = NLA_U32 },
-       [FRA_FWMARK]    = { .type = NLA_U32 },
-       [FRA_FWMASK]    = { .type = NLA_U32 },
        [FRA_FLOW]      = { .type = NLA_U32 },
-       [FRA_TABLE]     = { .type = NLA_U32 },
 };
 
 static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
index 26374cbe2bc2d5ce1cd2e3d04f469cac79897b32..8377477b2c1931a1433c53b8a5917b04dd479219 100644 (file)
@@ -130,13 +130,9 @@ static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
 }
 
 static struct nla_policy fib6_rule_policy[FRA_MAX+1] __read_mostly = {
-       [FRA_IFNAME]    = { .type = NLA_STRING, .len = IFNAMSIZ - 1 },
-       [FRA_PRIORITY]  = { .type = NLA_U32 },
+       FRA_GENERIC_POLICY,
        [FRA_SRC]       = { .len = sizeof(struct in6_addr) },
        [FRA_DST]       = { .len = sizeof(struct in6_addr) },
-       [FRA_FWMARK]    = { .type = NLA_U32 },
-       [FRA_FWMASK]    = { .type = NLA_U32 },
-       [FRA_TABLE]     = { .type = NLA_U32 },
 };
 
 static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb,