]> err.no Git - linux-2.6/blobdiff - include/net/fib_rules.h
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik...
[linux-2.6] / include / net / fib_rules.h
index 61375d9e53f820b47748619534ff914887034292..bc3c26494c3d2f4b578be0d12f4c20fd8e1b127c 100644 (file)
@@ -13,6 +13,8 @@ struct fib_rule
        atomic_t                refcnt;
        int                     ifindex;
        char                    ifname[IFNAMSIZ];
+       u32                     mark;
+       u32                     mark_mask;
        u32                     pref;
        u32                     flags;
        u32                     table;
@@ -50,6 +52,7 @@ struct fib_rules_ops
                                        struct nlmsghdr *,
                                        struct fib_rule_hdr *);
        u32                     (*default_pref)(void);
+       size_t                  (*nlmsg_payload)(struct fib_rule *);
 
        int                     nlgroup;
        struct nla_policy       *policy;
@@ -57,6 +60,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);
@@ -74,6 +84,13 @@ static inline void fib_rule_put(struct fib_rule *rule)
                call_rcu(&rule->rcu, fib_rule_put_rcu);
 }
 
+static inline u32 frh_get_table(struct fib_rule_hdr *frh, struct nlattr **nla)
+{
+       if (nla[FRA_TABLE])
+               return nla_get_u32(nla[FRA_TABLE]);
+       return frh->table;
+}
+
 extern int                     fib_rules_register(struct fib_rules_ops *);
 extern int                     fib_rules_unregister(struct fib_rules_ops *);