summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2008-07-28 15:07:46 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2008-07-28 15:07:46 -0700
commit56ce2ed0a08645dedb448691cb81adba0b9dee61 (patch)
tree8f15bd18f0bb65e6f743a7d363059aed5008b941
parent647b3bf5c2327a4a87abc2f685e974b2ba116600 (diff)
downloadquagga-56ce2ed0a08645dedb448691cb81adba0b9dee61.tar.bz2
quagga-56ce2ed0a08645dedb448691cb81adba0b9dee61.tar.xz
Do link detect in quagga, rather than kernel
Don't use kernel support for linkdetect in quagga. This reverts commit 8d95ee9f88945ee49932b1a9f7af5abe6048e6e6.
-rwxr-xr-xconfigure.ac12
-rwxr-xr-xdebian/rules1
-rw-r--r--zebra/Makefile.am7
-rw-r--r--zebra/if_linkdetect.c92
-rw-r--r--zebra/interface.c13
-rw-r--r--zebra/interface.h17
-rw-r--r--zebra/linkdetect_null.c28
7 files changed, 3 insertions, 167 deletions
diff --git a/configure.ac b/configure.ac
index 1d2b2a3a..9f18bd39 100755
--- a/configure.ac
+++ b/configure.ac
@@ -208,8 +208,6 @@ AC_ARG_ENABLE(bgp-announce,
[ --disable-bgp-announce, turn off BGP route announcement])
AC_ARG_ENABLE(netlink,
[ --enable-netlink force to use Linux netlink interface])
-AC_ARG_ENABLE(linkdetect,
-[ --enable-linkdetect use Linux link-detect configuration])
AC_ARG_ENABLE(broken-aliases,
[ --enable-broken-aliases enable aliases as distinct interfaces for Linux 2.2.X])
AC_ARG_ENABLE(snmp,
@@ -919,16 +917,6 @@ AC_CHECK_HEADER([net/if.h],
QUAGGA_INCLUDES)],
[], QUAGGA_INCLUDES )
-
-dnl ---------------------------------------------------------------
-dnl kernel link-detect enable via /proc/sys/net/ipv4/conf/ethX/link_detect
-dnl ---------------------------------------------------------------
-if test "${enable_linkdetect}" = "yes"; then
- AC_DEFINE(HAVE_LINKDETECT,1,Enable Linux kernel linkdetect)
- LINK_DETECT=if_linkdetect.o
-fi
-AC_SUBST(LINK_DETECT)
-
dnl -----------------------
dnl check proc file system.
dnl -----------------------
diff --git a/debian/rules b/debian/rules
index c5b8cae4..772d2efa 100755
--- a/debian/rules
+++ b/debian/rules
@@ -61,7 +61,6 @@ configure += --enable-logfile-mask=0640
configure += --enable-rtadv
configure += --enable-tcp-md5
configure += --enable-gcc-rdynamic
-configure += --enable-linkdetect
configure += $(xable_snmp)
configure += --with-libpam
configure += CFLAGS="$(CFLAGS)"
diff --git a/zebra/Makefile.am b/zebra/Makefile.am
index 8977c893..5d8db411 100644
--- a/zebra/Makefile.am
+++ b/zebra/Makefile.am
@@ -10,14 +10,13 @@ LIBCAP = @LIBCAP@
ipforward = @IPFORWARD@
if_method = @IF_METHOD@
if_proc = @IF_PROC@
-link_detect = @LINK_DETECT@
rt_method = @RT_METHOD@
rtread_method = @RTREAD_METHOD@
kernel_method = @KERNEL_METHOD@
other_method = @OTHER_METHOD@
ioctl_method = @IOCTL_METHOD@
-otherobj = $(ioctl_method) $(ipforward) $(if_method) $(if_proc) $(link_detect) \
+otherobj = $(ioctl_method) $(ipforward) $(if_method) $(if_proc) \
$(rt_method) $(rtread_method) $(kernel_method) $(other_method)
sbin_PROGRAMS = zebra
@@ -30,7 +29,7 @@ zebra_SOURCES = \
irdp_main.c irdp_interface.c irdp_packet.c router-id.c
testzebra_SOURCES = test_main.c zebra_rib.c interface.c connected.c debug.c \
- zebra_vty.c linkdetect_null.c \
+ zebra_vty.c \
kernel_null.c redistribute_null.c ioctl_null.c misc_null.c
noinst_HEADERS = \
@@ -43,7 +42,7 @@ testzebra_LDADD = $(LIBCAP) $(LIB_IPV6) ../lib/libzebra.la
zebra_DEPENDENCIES = $(otherobj)
-EXTRA_DIST = if_ioctl.c if_ioctl_solaris.c if_linkdetect.c if_netlink.c if_proc.c \
+EXTRA_DIST = if_ioctl.c if_ioctl_solaris.c if_netlink.c if_proc.c \
if_sysctl.c ipforward_aix.c ipforward_ews.c ipforward_proc.c \
ipforward_solaris.c ipforward_sysctl.c rt_ioctl.c rt_netlink.c \
rt_socket.c rtread_netlink.c rtread_proc.c rtread_sysctl.c \
diff --git a/zebra/if_linkdetect.c b/zebra/if_linkdetect.c
deleted file mode 100644
index 4f95c16e..00000000
--- a/zebra/if_linkdetect.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Interface link state tracking
- * Copyright (C) 2008 Stephen Hemminger
- *
- * This file is part of GNU Zebra.
- *
- * GNU Zebra is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * GNU Zebra is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <zebra.h>
-#include "log.h"
-#include "privs.h"
-#include "prefix.h"
-
-#include "zebra/interface.h"
-
-extern struct zebra_privs_t zserv_privs;
-
-static int
-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/%s/conf/%s/link_detect", ver, name);
-
- if ( zserv_privs.change(ZPRIVS_RAISE) )
- zlog_err ("Can't raise privileges, %s", safe_strerror (errno) );
-
- fp = fopen (proc_name, "w");
- save_errno = errno;
- if (!fp)
- {
- if ( zserv_privs.change(ZPRIVS_LOWER) )
- zlog_err ("Can't lower privileges, %s", safe_strerror (errno));
-
- zlog_info("Can't %s link-detect, %s:%s",
- onoff ? "enable" : "disable",
- proc_name, safe_strerror(save_errno));
- return -1;
- }
- else
- {
- fprintf (fp, "%d\n", onoff);
- fclose (fp);
-
- if ( zserv_privs.change(ZPRIVS_LOWER) )
- zlog_err ("Can't lower privileges, %s", safe_strerror (errno));
-
- return onoff;
- }
-}
-
-int
-if_linkdetect_on (const char *name)
-{
- return linkdetect (name, "ipv4", 1);
-}
-
-int
-if_linkdetect_off (const char *name)
-{
- 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 916c58a6..ce506056 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -32,7 +32,6 @@
#include "connected.h"
#include "log.h"
#include "zclient.h"
-#include "ipforward.h"
#include "zebra/interface.h"
#include "zebra/rtadv.h"
@@ -1032,12 +1031,6 @@ DEFUN (linkdetect,
if_was_operative = if_is_operative(ifp);
SET_FLAG(ifp->status, ZEBRA_INTERFACE_LINKDETECTION);
- /* 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);
@@ -1061,12 +1054,6 @@ DEFUN (no_linkdetect,
if_was_operative = if_is_operative(ifp);
UNSET_FLAG(ifp->status, ZEBRA_INTERFACE_LINKDETECTION);
- /* 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 114270e7..0a6b0365 100644
--- a/zebra/interface.h
+++ b/zebra/interface.h
@@ -234,23 +234,6 @@ extern int interface_list_proc (void);
extern int ifaddr_proc_ipv6 (void);
#endif /* HAVE_PROC_NET_IF_INET6 */
-#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
-
-
#ifdef BSDI
extern int if_kvm_get_mtu (struct interface *);
#endif /* BSDI */
diff --git a/zebra/linkdetect_null.c b/zebra/linkdetect_null.c
deleted file mode 100644
index 1f160c8e..00000000
--- a/zebra/linkdetect_null.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* NULL method for testing. */
-
-#include <zebra.h>
-
-
-int
-if_linkdetect_on (const char *name)
-{
- return 0;
-}
-
-int
-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;
-}