summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2008-05-28 08:57:30 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2008-05-28 08:57:30 -0700
commit6e69833249b701330913d80bd9b3c7c991ee61d5 (patch)
tree7bb53b1fe1170e04bdfd0a6a70465413188f6c84
parent99a9a0c9e045732e5977b24192e971ade92b59aa (diff)
downloadquagga-6e69833249b701330913d80bd9b3c7c991ee61d5.tar.bz2
quagga-6e69833249b701330913d80bd9b3c7c991ee61d5.tar.xz
Add ipv6 link detect hooks
Enable ipv6 link detect in kernel if needed.
-rw-r--r--zebra/if_linkdetect.c22
-rw-r--r--zebra/interface.c6
-rw-r--r--zebra/interface.h8
-rw-r--r--zebra/linkdetect_null.c12
4 files changed, 44 insertions, 4 deletions
diff --git a/zebra/if_linkdetect.c b/zebra/if_linkdetect.c
index 9ae7c6a6..9d0457aa 100644
--- a/zebra/if_linkdetect.c
+++ b/zebra/if_linkdetect.c
@@ -32,14 +32,14 @@
extern struct zebra_privs_t zserv_privs;
static int
-linkdetect (const char *name, int onoff)
+linkdetect (const char *name, const char *ver, int onoff)
{
FILE *fp;
int save_errno;
char proc_name[128];
snprintf(proc_name, sizeof(proc_name)-1,
- "/proc/sys/net/ipv4/conf/%s/link_detect", name);
+ "/proc/sys/net/%s/conf/%s/link_detect", ver, name);
if ( zserv_privs.change(ZPRIVS_RAISE) )
zlog_err ("Can't raise privileges, %s", safe_strerror (errno) );
@@ -71,11 +71,25 @@ linkdetect (const char *name, int onoff)
int
if_linkdetect_on (const char *name)
{
- return linkdetect (name, 1);
+ return linkdetect (name, "ipv4", 1);
}
int
if_linkdetect_off (const char *name)
{
- return linkdetect (name, 1);
+ return linkdetect (name, "ipv4", 0);
}
+
+#ifdef HAVE_IPV6
+int
+if_linkdetect_ipv6_on (const char *name)
+{
+ return linkdetect (name, "ipv6", 1);
+}
+
+int
+if_linkdetect_ipv6_off (const char *name)
+{
+ return linkdetect (name, "ipv6", 0);
+}
+#endif
diff --git a/zebra/interface.c b/zebra/interface.c
index f6d2ff9b..1be55c31 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -1032,6 +1032,9 @@ DEFUN (linkdetect,
/* Enable FIB to remove kernel routes as well */
if_linkdetect_on(ifp->name);
+#ifdef HAVE_IPV6
+ if_linkdetect_ipv6_on(ifp->name);
+#endif
/* When linkdetection is enabled, if might come down */
if (!if_is_operative(ifp) && if_was_operative) if_down(ifp);
@@ -1058,6 +1061,9 @@ DEFUN (no_linkdetect,
/* Disable FIB update on link-detect */
if_linkdetect_off(ifp->name);
+#ifdef HAVE_IPV6
+ if_linkdetect_ipv6_off(ifp->name);
+#endif
/* Interface may come up after disabling link detection */
if (if_is_operative(ifp) && !if_was_operative) if_up(ifp);
diff --git a/zebra/interface.h b/zebra/interface.h
index 6ab25bf4..114270e7 100644
--- a/zebra/interface.h
+++ b/zebra/interface.h
@@ -237,9 +237,17 @@ extern int ifaddr_proc_ipv6 (void);
#ifdef HAVE_LINKDETECT
extern int if_linkdetect_on (const char *);
extern int if_linkdetect_off (const char *);
+# ifdef HAVE_IPV6
+extern int if_linkdetect_ipv6_on (const char *);
+extern int if_linkdetect_ipv6_off (const char *);
+# endif
#else
#define if_linkdetect_on(name)
#define if_linkdetect_off(name)
+# ifdef HAVE_IPV6
+#define if_linkdetect_ipv6_on(name)
+#define if_linkdetect_ipv6_off(name)
+# endif
#endif
diff --git a/zebra/linkdetect_null.c b/zebra/linkdetect_null.c
index c33363e1..1f160c8e 100644
--- a/zebra/linkdetect_null.c
+++ b/zebra/linkdetect_null.c
@@ -14,3 +14,15 @@ if_linkdetect_off (const char *name)
{
return 0;
}
+
+int
+if_linkdetect_ipv6_on (const char *name)
+{
+ return 0;
+}
+
+int
+if_linkdetect_ipv6_off (const char *name)
+{
+ return 0;
+}