aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2007-08-09 02:12:56 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:47:49 -0400
commitd961db358f41033a8fc7b62948bc7cff1b4bb1fe (patch)
treebf776125a6fd2090698f478ab3bd56bcc568276d /net/core
parent4f494554f9b95d0de57c14c460d525e3715e3f6f (diff)
[NEIGH]: Netlink notifications
Currently neighbour event notifications are limited to update notifications and only sent if the ARP daemon is enabled. This patch extends the existing notification code by also reporting neighbours being removed due to gc or administratively and removes the dependency on the ARP daemon. This allows to keep track of neighbour states without periodically fetching the complete neighbour table. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/neighbour.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 4b815db94b6b..ecd43c4a2221 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -55,9 +55,8 @@
55#define PNEIGH_HASHMASK 0xF 55#define PNEIGH_HASHMASK 0xF
56 56
57static void neigh_timer_handler(unsigned long arg); 57static void neigh_timer_handler(unsigned long arg);
58#ifdef CONFIG_ARPD 58static void __neigh_notify(struct neighbour *n, int type, int flags);
59static void neigh_app_notify(struct neighbour *n); 59static void neigh_update_notify(struct neighbour *neigh);
60#endif
61static int pneigh_ifdown(struct neigh_table *tbl, struct net_device *dev); 60static int pneigh_ifdown(struct neigh_table *tbl, struct net_device *dev);
62void neigh_changeaddr(struct neigh_table *tbl, struct net_device *dev); 61void neigh_changeaddr(struct neigh_table *tbl, struct net_device *dev);
63 62
@@ -110,6 +109,7 @@ static void neigh_cleanup_and_release(struct neighbour *neigh)
110 if (neigh->parms->neigh_cleanup) 109 if (neigh->parms->neigh_cleanup)
111 neigh->parms->neigh_cleanup(neigh); 110 neigh->parms->neigh_cleanup(neigh);
112 111
112 __neigh_notify(neigh, RTM_DELNEIGH, 0);
113 neigh_release(neigh); 113 neigh_release(neigh);
114} 114}
115 115
@@ -830,13 +830,10 @@ static void neigh_timer_handler(unsigned long arg)
830out: 830out:
831 write_unlock(&neigh->lock); 831 write_unlock(&neigh->lock);
832 } 832 }
833
833 if (notify) 834 if (notify)
834 call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, neigh); 835 neigh_update_notify(neigh);
835 836
836#ifdef CONFIG_ARPD
837 if (notify && neigh->parms->app_probes)
838 neigh_app_notify(neigh);
839#endif
840 neigh_release(neigh); 837 neigh_release(neigh);
841} 838}
842 839
@@ -1065,11 +1062,8 @@ out:
1065 write_unlock_bh(&neigh->lock); 1062 write_unlock_bh(&neigh->lock);
1066 1063
1067 if (notify) 1064 if (notify)
1068 call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, neigh); 1065 neigh_update_notify(neigh);
1069#ifdef CONFIG_ARPD 1066
1070 if (notify && neigh->parms->app_probes)
1071 neigh_app_notify(neigh);
1072#endif
1073 return err; 1067 return err;
1074} 1068}
1075 1069
@@ -2002,6 +1996,11 @@ nla_put_failure:
2002 return -EMSGSIZE; 1996 return -EMSGSIZE;
2003} 1997}
2004 1998
1999static void neigh_update_notify(struct neighbour *neigh)
2000{
2001 call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, neigh);
2002 __neigh_notify(neigh, RTM_NEWNEIGH, 0);
2003}
2005 2004
2006static int neigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb, 2005static int neigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb,
2007 struct netlink_callback *cb) 2006 struct netlink_callback *cb)
@@ -2421,7 +2420,6 @@ static const struct file_operations neigh_stat_seq_fops = {
2421 2420
2422#endif /* CONFIG_PROC_FS */ 2421#endif /* CONFIG_PROC_FS */
2423 2422
2424#ifdef CONFIG_ARPD
2425static inline size_t neigh_nlmsg_size(void) 2423static inline size_t neigh_nlmsg_size(void)
2426{ 2424{
2427 return NLMSG_ALIGN(sizeof(struct ndmsg)) 2425 return NLMSG_ALIGN(sizeof(struct ndmsg))
@@ -2453,16 +2451,11 @@ errout:
2453 rtnl_set_sk_err(RTNLGRP_NEIGH, err); 2451 rtnl_set_sk_err(RTNLGRP_NEIGH, err);
2454} 2452}
2455 2453
2454#ifdef CONFIG_ARPD
2456void neigh_app_ns(struct neighbour *n) 2455void neigh_app_ns(struct neighbour *n)
2457{ 2456{
2458 __neigh_notify(n, RTM_GETNEIGH, NLM_F_REQUEST); 2457 __neigh_notify(n, RTM_GETNEIGH, NLM_F_REQUEST);
2459} 2458}
2460
2461static void neigh_app_notify(struct neighbour *n)
2462{
2463 __neigh_notify(n, RTM_NEWNEIGH, 0);
2464}
2465
2466#endif /* CONFIG_ARPD */ 2459#endif /* CONFIG_ARPD */
2467 2460
2468#ifdef CONFIG_SYSCTL 2461#ifdef CONFIG_SYSCTL