netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Graf <tgraf@suug.ch>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, Thomas Graf <tgraf@suug.ch>
Subject: [PATCH 5/6] [NET] rules: Share common attribute validation policy
Date: Thu, 09 Nov 2006 12:27:40 +0100	[thread overview]
Message-ID: <20061109113245.978740794@lsx.localdomain> (raw)
In-Reply-To: 20061109112735.577771022@lsx.localdomain

[-- Attachment #1: rules_share_policy --]
[-- Type: text/plain, Size: 3148 bytes --]

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>

Index: net-2.6.20/include/net/fib_rules.h
===================================================================
--- net-2.6.20.orig/include/net/fib_rules.h	2006-11-08 23:32:35.000000000 +0100
+++ net-2.6.20/include/net/fib_rules.h	2006-11-08 23:33:21.000000000 +0100
@@ -59,6 +59,13 @@
 	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: net-2.6.20/net/decnet/dn_rules.c
===================================================================
--- net-2.6.20.orig/net/decnet/dn_rules.c	2006-11-08 23:32:35.000000000 +0100
+++ net-2.6.20/net/decnet/dn_rules.c	2006-11-08 23:33:21.000000000 +0100
@@ -108,13 +108,9 @@
 }
 
 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: net-2.6.20/net/ipv4/fib_rules.c
===================================================================
--- net-2.6.20.orig/net/ipv4/fib_rules.c	2006-11-08 23:32:35.000000000 +0100
+++ net-2.6.20/net/ipv4/fib_rules.c	2006-11-08 23:33:21.000000000 +0100
@@ -170,14 +170,10 @@
 }
 
 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: net-2.6.20/net/ipv6/fib6_rules.c
===================================================================
--- net-2.6.20.orig/net/ipv6/fib6_rules.c	2006-11-08 23:32:35.000000000 +0100
+++ net-2.6.20/net/ipv6/fib6_rules.c	2006-11-08 23:33:21.000000000 +0100
@@ -130,13 +130,9 @@
 }
 
 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,

--


  parent reply	other threads:[~2006-11-09 11:33 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-09 11:27 [PATCHSET] packet mark & fib rules work Thomas Graf
2006-11-09 11:27 ` [PATCH 1/6] [NET]: Turn nfmark into generic mark Thomas Graf
2006-11-09 12:32   ` Meelis Roos
2006-11-09 12:45     ` Thomas Graf
2006-11-09 13:03       ` Meelis Roos
2006-11-09 23:19   ` [PATCH 1/6] [NET]: " David Miller
2006-11-09 11:27 ` [PATCH 2/6] [NET]: Rethink mark field in struct flowi Thomas Graf
2006-11-09 13:23   ` Eric Dumazet
2006-11-09 13:34     ` Thomas Graf
2006-11-09 23:21   ` David Miller
2006-11-09 11:27 ` [PATCH 3/6] [IPv4] nl_fib_lookup: Rename fl_fwmark to fl_mark Thomas Graf
2006-11-09 23:21   ` David Miller
2006-11-09 11:27 ` [PATCH 4/6] [NET] rules: Protocol independant mark selector Thomas Graf
2006-11-09 23:22   ` David Miller
2006-11-09 11:27 ` Thomas Graf [this message]
2006-11-09 23:23   ` [PATCH 5/6] [NET] rules: Share common attribute validation policy David Miller
2006-11-09 11:27 ` [PATCH 6/6] [NET] rules: Add support to invert selectors Thomas Graf
2006-11-09 11:38   ` [IPROUTE2] Add support for inverted selectors Thomas Graf
2006-11-09 16:56     ` Stephen Hemminger
2006-11-09 23:23   ` [PATCH 6/6] [NET] rules: Add support to invert selectors David Miller
2006-11-09 11:46 ` [PATCHSET] packet mark & fib rules work Steven Whitehouse
2006-11-09 12:49   ` Thomas Graf
2006-11-09 14:55     ` Steven Whitehouse
2006-11-10 14:30       ` Thomas Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061109113245.978740794@lsx.localdomain \
    --to=tgraf@suug.ch \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).