Rules and groups

2006-08-09 Thread Steven Whitehouse
Hi,

With your new protocol independent rules code, I see that there is an
entry in struct fib_rules_ops for a netlink group for notification of
rule changes. For whatever reason (historical I guess) DECnet has never
had a nl group assigned for this, so I'm left with two choices when moving
the code over to ues your new scheme.

Either I could send a patch to put the content of notify_rule_change()
conditional on nlgroup being non-zero, or I could assign a suitable
group for DECnet rule changes. I'm leaning towards the latter as the
best solution, so that at least it matches up with the other protocols.

Is there anything to stop me using RTNLGRP_NOP3 for that? (suitable renamed
of course!) So far as I can see its never been assigned to anything else...

Steve.

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Rules and groups

2006-08-09 Thread David Miller
From: Steven Whitehouse [EMAIL PROTECTED]
Date: Wed, 9 Aug 2006 09:01:39 +0100

 Is there anything to stop me using RTNLGRP_NOP3 for that? (suitable
 renamed of course!) So far as I can see its never been assigned to
 anything else...

I have no objection to you using it.

These nops exist because the table used to be a bunch of bitmask
defines instead of the present enum:

#define RTMGRP_LINK 1
#define RTMGRP_NOTIFY   2
#define RTMGRP_NEIGH4
#define RTMGRP_TC   8

#define RTMGRP_IPV4_IFADDR  0x10
#define RTMGRP_IPV4_MROUTE  0x20
#define RTMGRP_IPV4_ROUTE   0x40

#define RTMGRP_IPV6_IFADDR  0x100
#define RTMGRP_IPV6_MROUTE  0x200
#define RTMGRP_IPV6_ROUTE   0x400

#define RTMGRP_DECnet_IFADDR0x1000
#define RTMGRP_DECnet_ROUTE 0x4000

That is from 2.4.x
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Rules and groups

2006-08-09 Thread Thomas Graf
* Steven Whitehouse [EMAIL PROTECTED] 2006-08-09 09:01
 With your new protocol independent rules code, I see that there is an
 entry in struct fib_rules_ops for a netlink group for notification of
 rule changes. For whatever reason (historical I guess) DECnet has never
 had a nl group assigned for this, so I'm left with two choices when moving
 the code over to ues your new scheme.
 
 Either I could send a patch to put the content of notify_rule_change()
 conditional on nlgroup being non-zero, or I could assign a suitable
 group for DECnet rule changes. I'm leaning towards the latter as the
 best solution, so that at least it matches up with the other protocols.

Absolutely, notification for DECnet rule changes would be nice to have.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Rules and groups

2006-08-09 Thread Steven Whitehouse
Hi,

On Wed, Aug 09, 2006 at 01:01:25AM -0700, David Miller wrote:
 From: Steven Whitehouse [EMAIL PROTECTED]
 Date: Wed, 9 Aug 2006 09:01:39 +0100
 
  Is there anything to stop me using RTNLGRP_NOP3 for that? (suitable
  renamed of course!) So far as I can see its never been assigned to
  anything else...
 
 I have no objection to you using it.

Excellent. Please find attached my attempt at doing the conversion to the
generic rules code. It appears to work ok for me. You can also pull this
patch from the decnet git tree at:

git://git.kernel.org/pub/scm/linux/kernel/git/steve/decnet-2.6.19.git

which was cloned from net-2.6.19.git quite recently. In addition the
git tree has another patch which is in a following email.

Patrick: does this patch get your blessing?

Steve.

-

[DECnet] Covert rules to use generic code

This patch converts the DECnet rules code to use the generic
rules system created by Thomas Graf [EMAIL PROTECTED].

Signed-off-by: Steven Whitehouse [EMAIL PROTECTED]

---

 include/linux/rtnetlink.h |3 
 include/net/dn_fib.h  |8 -
 net/decnet/Kconfig|1 
 net/decnet/af_decnet.c|1 
 net/decnet/dn_dev.c   |3 
 net/decnet/dn_fib.c   |1 
 net/decnet/dn_route.c |3 
 net/decnet/dn_rules.c |  492 +
 net/decnet/dn_table.c |1 
 9 files changed, 195 insertions(+), 318 deletions(-)

0ff88cb56e1674234a8aaacb7869bc004252c0c2
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index bf35353..ea02e7d 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -885,7 +885,8 @@ enum rtnetlink_groups {
RTNLGRP_NOP2,
RTNLGRP_DECnet_ROUTE,
 #define RTNLGRP_DECnet_ROUTE   RTNLGRP_DECnet_ROUTE
-   RTNLGRP_NOP3,
+   RTNLGRP_DECnet_RULE,
+#define RTNLGRP_DECnet_RULERTNLGRP_DECnet_RULE
RTNLGRP_NOP4,
RTNLGRP_IPV6_PREFIX,
 #define RTNLGRP_IPV6_PREFIXRTNLGRP_IPV6_PREFIX
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h
index a15dcf0..32bc8ce 100644
--- a/include/net/dn_fib.h
+++ b/include/net/dn_fib.h
@@ -22,7 +22,7 @@ struct dn_kern_rta
 };
 
 struct dn_fib_res {
-   struct dn_fib_rule *r;
+   struct fib_rule *r;
struct dn_fib_info *fi;
unsigned char prefixlen;
unsigned char nh_sel;
@@ -147,10 +147,8 @@ extern void dn_fib_table_cleanup(void);
  */
 extern void dn_fib_rules_init(void);
 extern void dn_fib_rules_cleanup(void);
-extern void dn_fib_rule_put(struct dn_fib_rule *);
-extern __le16 dn_fib_rules_policy(__le16 saddr, struct dn_fib_res *res, 
unsigned *flags);
 extern unsigned dnet_addr_type(__le16 addr);
-extern int dn_fib_lookup(const struct flowi *fl, struct dn_fib_res *res);
+extern int dn_fib_lookup(struct flowi *fl, struct dn_fib_res *res);
 
 /*
  * rtnetlink interface
@@ -176,7 +174,7 @@ static inline void dn_fib_res_put(struct
if (res-fi)
dn_fib_info_put(res-fi);
if (res-r)
-   dn_fib_rule_put(res-r);
+   fib_rule_put(res-r);
 }
 
 extern struct dn_fib_table *dn_fib_tables[];
diff --git a/net/decnet/Kconfig b/net/decnet/Kconfig
index 92f2ec4..36e72cb 100644
--- a/net/decnet/Kconfig
+++ b/net/decnet/Kconfig
@@ -27,6 +27,7 @@ config DECNET
 config DECNET_ROUTER
bool DECnet: router support (EXPERIMENTAL)
depends on DECNET  EXPERIMENTAL
+   select FIB_RULES
---help---
  Add support for turning your DECnet Endnode into a level 1 or 2
  router.  This is an experimental, but functional option.  If you
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index 5486247..70e0273 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -130,6 +130,7 @@ Version 0.0.62.1.110   07-aug-98   E
 #include linux/poll.h
 #include net/neighbour.h
 #include net/dst.h
+#include net/fib_rules.h
 #include net/dn.h
 #include net/dn_nsp.h
 #include net/dn_dev.h
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index 476455f..9ab2e5b 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -45,6 +45,7 @@
 #include net/neighbour.h
 #include net/dst.h
 #include net/flow.h
+#include net/fib_rules.h
 #include net/dn.h
 #include net/dn_dev.h
 #include net/dn_route.h
@@ -1417,8 +1418,6 @@ static struct rtnetlink_link dnet_rtnetl
[RTM_DELROUTE - RTM_BASE] = { .doit = dn_fib_rtm_delroute,  },
[RTM_GETROUTE - RTM_BASE] = { .doit = dn_cache_getroute,
  .dumpit   = dn_fib_dump,  },
-   [RTM_NEWRULE  - RTM_BASE] = { .doit = dn_fib_rtm_newrule,   },
-   [RTM_DELRULE  - RTM_BASE] = { .doit = dn_fib_rtm_delrule,   },
[RTM_GETRULE  - RTM_BASE] = { .dumpit   = dn_fib_dump_rules,},
 #else
[RTM_GETROUTE - RTM_BASE] = { .doit = dn_cache_getroute,
diff --git a/net/decnet/dn_fib.c b/net/decnet/dn_fib.c
index 

Re: Rules and groups

2006-08-09 Thread Thomas Graf
* Steven Whitehouse [EMAIL PROTECTED] 2006-08-09 11:03
 On Wed, Aug 09, 2006 at 01:01:25AM -0700, David Miller wrote:
  From: Steven Whitehouse [EMAIL PROTECTED]
  Date: Wed, 9 Aug 2006 09:01:39 +0100
  
   Is there anything to stop me using RTNLGRP_NOP3 for that? (suitable
   renamed of course!) So far as I can see its never been assigned to
   anything else...
  
  I have no objection to you using it.
 
 Excellent. Please find attached my attempt at doing the conversion to the
 generic rules code. It appears to work ok for me. You can also pull this
 patch from the decnet git tree at:

Looks good to me.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Rules and groups

2006-08-09 Thread Patrick Caulfield

Steven Whitehouse wrote:

Hi,

On Wed, Aug 09, 2006 at 01:01:25AM -0700, David Miller wrote:

From: Steven Whitehouse [EMAIL PROTECTED]
Date: Wed, 9 Aug 2006 09:01:39 +0100


Is there anything to stop me using RTNLGRP_NOP3 for that? (suitable
renamed of course!) So far as I can see its never been assigned to
anything else...

I have no objection to you using it.


Excellent. Please find attached my attempt at doing the conversion to the
generic rules code. It appears to work ok for me. You can also pull this
patch from the decnet git tree at:

git://git.kernel.org/pub/scm/linux/kernel/git/steve/decnet-2.6.19.git

which was cloned from net-2.6.19.git quite recently. In addition the
git tree has another patch which is in a following email.

Patrick: does this patch get your blessing?




Yes, that works fine for me.


--
patrick
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Rules and groups

2006-08-09 Thread David Miller
From: Steven Whitehouse [EMAIL PROTECTED]
Date: Wed, 9 Aug 2006 11:03:26 +0100

 [DECnet] Covert rules to use generic code
 
 This patch converts the DECnet rules code to use the generic
 rules system created by Thomas Graf [EMAIL PROTECTED].
 
 Signed-off-by: Steven Whitehouse [EMAIL PROTECTED]

Patch applied, thanks Steven.

I know it may seem like a minor detail, but can you format your top
comment line like this:

[DECNET]: Covert rules to use generic code

I've been making this transformation by hand.

The important parts for me are:

[X]: blah

Where X is the main subsystem name in all capital letters,
and there is a colon after the closing right bracket.  If
there is a specific sub-area being effected, the following
is a nice way to show that:

[X] subarea: blah

This makes all of the networking changesets look consistent
and it's easier for human eyes to scan the changeset lines
if we make an effort to do it this way.

Thanks!

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html