]> git.proxmox.com Git - mirror_frr.git/commitdiff
Merge pull request #1514 from donaldsharp/watchfrr
authorMartin Winter <mwinter@opensourcerouting.org>
Tue, 12 Dec 2017 16:51:25 +0000 (08:51 -0800)
committerGitHub <noreply@github.com>
Tue, 12 Dec 2017 16:51:25 +0000 (08:51 -0800)
tools, watchfrr: Modify timeout to 90 seconds

45 files changed:
babeld/babeld.c
babeld/kernel.c
babeld/kernel.h
bgpd/bgp_attr.c
bgpd/bgp_routemap.c
bgpd/bgp_rpki.c
bgpd/bgp_vty.c
bgpd/bgpd.c
bgpd/rfapi/rfapi_import.c
bgpd/rfapi/rfapi_rib.c
bgpd/rfapi/rfapi_vty.c
bgpd/rfapi/vnc_import_bgp.c
debianpkg/Makefile.am
debianpkg/README.deb_build.md
debianpkg/backports/ubuntu17.10/debian/control [new file with mode: 0644]
debianpkg/backports/ubuntu17.10/debian/source/format [new file with mode: 0644]
debianpkg/backports/ubuntu17.10/exclude [new file with mode: 0644]
debianpkg/backports/ubuntu17.10/versionext [new file with mode: 0644]
debianpkg/frr.preinst
debianpkg/rules
doc/cli.md
ldpd/ldp_debug.c
ldpd/ldp_debug.h
ldpd/subdir.am
lib/csv.c
lib/plist.c
lib/ptm_lib.c
lib/ptm_lib.h
ospf6d/ospf6_route.c
ospfd/ospf_vty.c
sharpd/sharp_vty.c
watchfrr/watchfrr.c
zebra/interface.h
zebra/ipforward_proc.c
zebra/rib.h
zebra/rt.h
zebra/rt_netlink.c
zebra/rt_socket.c
zebra/rtadv.c
zebra/zebra_mpls.c
zebra/zebra_mpls_netlink.c
zebra/zebra_mpls_null.c
zebra/zebra_mpls_openbsd.c
zebra/zebra_ptm.c
zebra/zebra_rib.c

index 00367612c624d94d97e9b6be14d3fe1ecb84c527..20dd098f33026754713b51f3b2c642c570ea5257 100644 (file)
@@ -229,7 +229,7 @@ babel_get_myid(void)
         int ifindex = if_nametoindex(ifp->name);
         if(ifindex > 0) {
             unsigned char eui[8];
-            rc = if_eui64(ifp->name, ifindex, eui);
+            rc = if_eui64(ifindex, eui);
             if(rc < 0)
                 continue;
             memcpy(myid, eui, 8);
@@ -245,7 +245,7 @@ babel_get_myid(void)
         ifname = if_indextoname(i, buf);
         if(ifname == NULL)
             continue;
-        rc = if_eui64(ifname, i, eui);
+        rc = if_eui64(i, eui);
         if(rc < 0)
             continue;
         memcpy(myid, eui, 8);
index 3343ca2e9538a3acba11a10a72d6be72df0ad0f7..8c4fc953e7abe217599dac2514f1bb1c4d96b33f 100644 (file)
@@ -203,7 +203,7 @@ zebra_route(int add, int family, const unsigned char *pref, unsigned short plen,
 }
 
 int
-if_eui64(char *ifname, int ifindex, unsigned char *eui)
+if_eui64(int ifindex, unsigned char *eui)
 {
     struct interface *ifp = if_lookup_by_index(ifindex, VRF_DEFAULT);
     if (ifp == NULL) {
index 7ade26dc3655948691fe27b75d7df2fcfc383ce7..eb1e793279c52b9b4c5878d6a592d0df3c9bc060 100644 (file)
@@ -40,7 +40,7 @@ int kernel_route(int operation, const unsigned char *dest, unsigned short plen,
                  const unsigned char *gate, int ifindex, unsigned int metric,
                  const unsigned char *newgate, int newifindex,
                  unsigned int newmetric);
-int if_eui64(char *ifname, int ifindex, unsigned char *eui);
+int if_eui64(int ifindex, unsigned char *eui);
 int gettime(struct timeval *tv);
 int read_random_bytes(void *buf, size_t len);
 
index 1f0662bfb01c519d16eb921a5b8fe268e51644a2..e80889500f089df249d0dbeb656f51124b532bb4 100644 (file)
@@ -1667,7 +1667,11 @@ int bgp_mp_reach_parse(struct bgp_attr_parser_args *args,
                /*
                 * NOTE: intentional fall through
                 * - for consistency in rx processing
+                *
+                * The following comment is to signal GCC this intention
+                * and supress the warning
                 */
+               /* FALLTHRU */
        case BGP_ATTR_NHLEN_IPV4:
                stream_get(&attr->mp_nexthop_global_in, s, IPV4_MAX_BYTELEN);
                /* Probably needed for RFC 2283 */
index 30397f84877d45bc02925299f6a6b19fdef7a231..8c9f9f65ca4e4b3894e6d27ae7d2435b41ecaca1 100644 (file)
@@ -2082,7 +2082,10 @@ static void *route_set_aggregator_as_compile(const char *arg)
 
        aggregator =
                XCALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(struct aggregator));
-       sscanf(arg, "%s %s", as, address);
+       if (sscanf(arg, "%s %s", as, address) != 2) {
+               XFREE(MTYPE_ROUTE_MAP_COMPILED, aggregator);
+               return NULL;
+       }
 
        aggregator->as = strtoul(as, NULL, 10);
        ret = inet_aton(address, &aggregator->address);
index 1a42478513f853ff4d22defd182dacd4d98c7cf2..19d4769cd3fef1371c00310e0a720595735c39c3 100644 (file)
@@ -52,7 +52,9 @@
 #include "libfrr.h"
 #include "version.h"
 
-#include "bgp_rpki_clippy.c"
+#ifndef VTYSH_EXTRACT_PL
+#include "bgpd/bgp_rpki_clippy.c"
+#endif
 
 DEFINE_MTYPE_STATIC(BGPD, BGP_RPKI_CACHE, "BGP RPKI Cache server")
 DEFINE_MTYPE_STATIC(BGPD, BGP_RPKI_CACHE_GROUP, "BGP RPKI Cache server group")
index a6738107381bf62b187a57ceab24e724776cf464..5515643ed1ae185fca4696c66df79ffe8937b35f 100644 (file)
@@ -721,7 +721,7 @@ static void bgp_clear_star_soft_out(struct vty *vty, const char *name)
 
 
 #ifndef VTYSH_EXTRACT_PL
-#include "bgp_vty_clippy.c"
+#include "bgpd/bgp_vty_clippy.c"
 #endif
 
 /* BGP global configuration.  */
index 8aaf19c7e1e09c5d25c5d8e8c82c2332de2975fc..56e18db3110e60a6fbda37844c9442fe165a6693 100644 (file)
@@ -912,7 +912,7 @@ static void peer_global_config_reset(struct peer *peer)
 }
 
 /* Check peer's AS number and determines if this peer is IBGP or EBGP */
-static bgp_peer_sort_t peer_calc_sort(struct peer *peer)
+static inline bgp_peer_sort_t peer_calc_sort(struct peer *peer)
 {
        struct bgp *bgp;
 
@@ -1204,7 +1204,7 @@ void peer_xfer_config(struct peer *peer_dst, struct peer *peer_src)
        peer_dst->local_as = peer_src->local_as;
        peer_dst->ifindex = peer_src->ifindex;
        peer_dst->port = peer_src->port;
-       peer_sort(peer_dst);
+       (void)peer_sort(peer_dst);
        peer_dst->rmap_type = peer_src->rmap_type;
 
        /* Timers */
@@ -1882,6 +1882,11 @@ static int peer_activate_af(struct peer *peer, afi_t afi, safi_t safi)
                                                BGP_NOTIFY_CEASE_CONFIG_CHANGE);
                        }
                }
+               if (peer->status == OpenSent || peer->status == OpenConfirm) {
+                       peer->last_reset = PEER_DOWN_AF_ACTIVATE;
+                       bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+                                       BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+               }
        }
 
        return 0;
index cdbc88c967ad47115fef733f0a2cfaf30f4e3ad7..87c4509c49fae623fdcdb901aa5749187388077b 100644 (file)
@@ -1452,7 +1452,7 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
                                       __func__, __LINE__, have_vnc_tunnel_un);
 #endif
 
-               if (!have_vnc_tunnel_un && bi && bi->extra) {
+               if (!have_vnc_tunnel_un && bi->extra) {
                        /*
                         * use cached UN address from ENCAP route
                         */
@@ -3947,7 +3947,7 @@ void rfapiProcessUpdate(struct peer *peer,
                vnc_zlog_debug_verbose(
                        "%s: rfapiEcommunityGetLNI returned %d, lni=%d, attr=%p",
                        __func__, rc, lni, attr);
-               if (attr && !rc) {
+               if (!rc) {
                        it = rfapiMacImportTableGet(bgp, lni);
 
                        rfapiBgpInfoFilteredImportVPN(
index 36ae6e7273776644e6738bd5a7bdcb75513a981a..8d77cfa7d898de2886042350aaaa25ea91e83235 100644 (file)
@@ -207,7 +207,7 @@ void rfapiRibCheckCounts(
                }
        }
 
-       if (checkstats && bgp && bgp->rfapi) {
+       if (checkstats && bgp->rfapi) {
                if (t_pfx_active != bgp->rfapi->rib_prefix_count_total) {
                        vnc_zlog_debug_verbose(
                                "%s: actual total pfx count %u != running %u",
@@ -688,13 +688,10 @@ static void rfapiRibBi2Ri(struct bgp_info *bi, struct rfapi_info *ri,
                memcpy(&vo->v.l2addr.macaddr, bi->extra->vnc.import.rd.val + 2,
                       ETH_ALEN);
 
-               if (bi->attr) {
-                       (void)rfapiEcommunityGetLNI(
-                               bi->attr->ecommunity,
-                               &vo->v.l2addr.logical_net_id);
-                       (void)rfapiEcommunityGetEthernetTag(
-                               bi->attr->ecommunity, &vo->v.l2addr.tag_id);
-               }
+               (void)rfapiEcommunityGetLNI(bi->attr->ecommunity,
+                                           &vo->v.l2addr.logical_net_id);
+               (void)rfapiEcommunityGetEthernetTag(bi->attr->ecommunity,
+                                                   &vo->v.l2addr.tag_id);
 
                /* local_nve_id comes from RD */
                vo->v.l2addr.local_nve_id = bi->extra->vnc.import.rd.val[1];
@@ -710,7 +707,7 @@ static void rfapiRibBi2Ri(struct bgp_info *bi, struct rfapi_info *ri,
        /*
         * If there is an auxiliary IP address (L2 can have it), copy it
         */
-       if (bi && bi->extra && bi->extra->vnc.import.aux_prefix.family) {
+       if (bi->extra && bi->extra->vnc.import.aux_prefix.family) {
                ri->rk.aux_prefix = bi->extra->vnc.import.aux_prefix;
        }
 }
index 6af99278bce3de085e9b664b2e4ebbb8e7b2dfd3..3cd83a957ed1041e6ebd5de18b908f3b404c80c1 100644 (file)
@@ -1146,7 +1146,7 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream,
 
                char buf_age[BUFSIZ];
 
-               if (bi && bi->extra && bi->extra->vnc.import.create_time) {
+               if (bi->extra && bi->extra->vnc.import.create_time) {
                        rfapiFormatAge(bi->extra->vnc.import.create_time,
                                       buf_age, BUFSIZ);
                } else {
@@ -1163,7 +1163,7 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream,
                 * print that on the next line
                 */
 
-               if (bi && bi->extra
+               if (bi->extra
                    && bi->extra->vnc.import.aux_prefix.family) {
                        const char *sp;
 
index 05fbd180560dccb5f0127a878fc028b6a55b0580..d61a6c428534d13cec254632282663c8f2e04e74 100644 (file)
@@ -1183,7 +1183,8 @@ static void vnc_import_bgp_del_route_mode_nvegroup(struct bgp *bgp,
 
        assert(afi);
 
-       assert((rfg = bgp->rfapi_cfg->rfg_redist));
+       rfg = bgp->rfapi_cfg->rfg_redist;
+       assert(rfg);
 
        /*
         * Compute VN address
@@ -1450,7 +1451,7 @@ void vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
                return;
        }
 
-       if (bgp && bgp->rfapi)
+       if (bgp->rfapi)
                sl = bgp->rfapi->resolve_nve_nexthop;
 
        if (!sl) {
@@ -1597,7 +1598,7 @@ void vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
                return;
        }
 
-       if (bgp && bgp->rfapi)
+       if (bgp->rfapi)
                sl = bgp->rfapi->resolve_nve_nexthop;
 
        if (!sl) {
index 5ab5b4c4fc2181c1f58c08a0837985e418007a35..6bb01dffba005e72915cc55ce49c1a60410bc74d 100644 (file)
@@ -29,6 +29,10 @@ EXTRA_DIST = README.Debian README.Maintainer \
        backports/ubuntu16.04/debian/source/format \
        backports/ubuntu16.04/exclude \
        backports/ubuntu16.04/versionext \
+       backports/ubuntu17.10/debian/control \
+       backports/ubuntu17.10/debian/source/format \
+       backports/ubuntu17.10/exclude \
+       backports/ubuntu17.10/versionext \
        frr-doc.docs frr-doc.info frr-doc.install \
        frr-doc.lintian-overrides frr.conf \
        frr.dirs frr.docs frr.install \
index 3156c3672dd35a7f0f04a7fe85efaadb378cba0e..0d02bc3dc29ab62f225c6e14a95eef4f1f09b12b 100644 (file)
@@ -1,21 +1,26 @@
 Building your own FRRouting Debian Package
 ==========================================
-(Tested on Ubuntu 12.04, 14.04, 16.04 and Debian 8)
+(Tested on Ubuntu 12.04, 14.04, 16.04, 17.10, Debian 8 and 9)
+
+**Note:**  If you try to build for a different distro, then it will most likely
+fail because of the missing backport. See debianpkg/backports/README about
+adding a new backport.
 
 1. Follow the package installation as outlined in doc/Building_on_XXXX.md
    (XXXX refers your OS Distribution) to install the required build packages
 
 2. Install the following additional packages:
 
-        apt-get install realpath equivs groff fakeroot debhelper
+        apt-get install realpath equivs groff fakeroot debhelper devscripts
 
 3. Checkout FRR under a **unpriviledged** user account
 
         git clone https://github.com/frrouting/frr.git frr
+        cd frr
+       # git checkout <branch>    - if different branch than master
 
 4. Run Bootstrap and make distribution tar.gz
 
-        cd frr
         ./bootstrap.sh
         ./configure --with-pkg-extra-version=-MyDebPkgVersion
         make dist
@@ -44,7 +49,7 @@ Building your own FRRouting Debian Package
     and multiple `frr_*.debian.tar.xz` and `frr_*.dsc` for the debian package
     source on each backport supported distribution
 
-6. Create a new directory to build the package and populate with package src
+7. Create a new directory to build the package and populate with package src
 
         mkdir frrpkg
         cd frrpkg
@@ -53,12 +58,21 @@ Building your own FRRouting Debian Package
         . /etc/os-release
         tar xf ~/frr/frr_*${ID}${VERSION_ID}*.debian.tar.xz
 
-7. Build Debian Package Dependencies and install them as needed
+8. Build Debian Package Dependencies and install them as needed
 
         sudo mk-build-deps --install debian/control
 
-8. Build Debian Package
+9. Build Debian Package
+
+    Building with standard options:
+
+        debuild -b -uc -us
+
+    Or change some options:
+    (see `rules` file for available options)
 
+        export WANT_BGP_VNC=1
+       export WANT_WANT_CUMULUS_MODE=1
         debuild -b -uc -us
 
 DONE.
@@ -83,7 +97,7 @@ allowed.
 
             sudo update-rc.d frr defaults
 
-    - On `systemd` based systems (Debian 8, Ubuntu 14.04, 16.04)
+    - On `systemd` based systems (Debian 8, 9, Ubuntu 14.04, 16.04, 17.10)
 
             sudo systemctl enable frr
 
@@ -93,7 +107,7 @@ allowed.
 
             sudo invoke-rc.d frr start
 
-    - on `systemd` based systems (Debian 8, Ubuntu 14.04, 16.04)
+    - on `systemd` based systems (Debian 8, 9, Ubuntu 14.04, 16.04, 17.10)
 
             sudo systemctl start frr
 
diff --git a/debianpkg/backports/ubuntu17.10/debian/control b/debianpkg/backports/ubuntu17.10/debian/control
new file mode 100644 (file)
index 0000000..692501d
--- /dev/null
@@ -0,0 +1,54 @@
+Source: frr
+Section: net
+Priority: optional
+Maintainer: Nobody <nobody@frrouting.org>
+Uploaders: Nobody <nobody@frrouting.org>
+XSBC-Original-Maintainer: <maintainers@frrouting.org>
+Build-Depends: debhelper (>= 7.0.50~), libncurses5-dev, libreadline-dev, texlive-latex-base, texlive-generic-recommended, libpam0g-dev | libpam-dev, libcap-dev, texinfo (>= 4.7), imagemagick, ghostscript, groff, autotools-dev, libpcre3-dev, gawk, chrpath, libsnmp-dev, git, dh-autoreconf, libjson-c-dev, libjson-c2 | libjson-c3, dh-systemd, libsystemd-dev, bison, flex, libc-ares-dev, pkg-config, python (>= 2.7), python-ipaddr
+Standards-Version: 3.9.6
+Homepage: http://www.frrouting.org/
+
+Package: frr
+Architecture: any
+Depends: ${shlibs:Depends}, logrotate (>= 3.2-11), iproute2 | iproute, ${misc:Depends}, libc-ares2
+Pre-Depends: adduser
+Conflicts: zebra, zebra-pj, quagga
+Replaces: zebra, zebra-pj
+Suggests: snmpd
+Description: BGP/OSPF/RIP/RIPng/ISIS/PIM/LDP routing daemon forked from Quagga
+ FRR is free software which manages TCP/IP based routing protocols.
+ It supports BGP4, BGP4+, OSPFv2, OSPFv3, IS-IS, RIPv1, RIPv2, RIPng,
+ PIM and LDP as well as the IPv6 versions of these.
+ .
+ FRR is a fork of Quagga with an open community model. The main git
+ lives on https://github.com/frrouting/frr.git
+
+Package: frr-dbg
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, frr (= ${binary:Version})
+Priority: optional
+Section: debug
+Description: BGP/OSPF/RIP/RIPng/ISIS/PIM/LDP routing daemon (debug symbols)
+ This package provides debugging symbols for all binary packages built 
+ from frr source package. It's highly recommended to have this package
+ installed before reporting any FRR crashes to either FRR developers or 
+ Debian package maintainers.
+
+Package: frr-doc
+Section: net
+Architecture: all
+Depends: ${misc:Depends}
+Suggests: frr
+Description: BGP/OSPF/RIP/RIPng/ISIS/PIM/LDP routing daemon (documentation)
+ This package includes info files for frr, a free software which manages
+ TCP/IP based routing protocols.  It supports BGP4, BGP4+, OSPFv2, OSPFv3,
+ IS-IS, RIPv1, RIPv2, RIPng, PIM and LDP as well as the IPv6 versions of these.
+
+Package: frr-pythontools
+Section: net
+Architecture: all
+Depends: ${misc:Depends}, frr (= ${binary:Version}), python (>= 2.7), python-ipaddr
+Description: BGP/OSPF/RIP/RIPng/ISIS/PIM/LDP routing daemon (Python Tools)
+ This package includes info files for frr, a free software which manages
+ TCP/IP based routing protocols.  It supports BGP4, BGP4+, OSPFv2, OSPFv3,
+ IS-IS, RIPv1, RIPv2, RIPng, PIM and LDP as well as the IPv6 versions of these.
diff --git a/debianpkg/backports/ubuntu17.10/debian/source/format b/debianpkg/backports/ubuntu17.10/debian/source/format
new file mode 100644 (file)
index 0000000..163aaf8
--- /dev/null
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debianpkg/backports/ubuntu17.10/exclude b/debianpkg/backports/ubuntu17.10/exclude
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/debianpkg/backports/ubuntu17.10/versionext b/debianpkg/backports/ubuntu17.10/versionext
new file mode 100644 (file)
index 0000000..bfbeccd
--- /dev/null
@@ -0,0 +1 @@
+-1~ubuntu17.10+1
index 29162e3b56a92bab011cf527d0ed0d29a35280b7..467bea971834adf8f4205e2e3f7817de3d5a1626 100644 (file)
@@ -30,7 +30,7 @@ fi
 # frr and as such we need to intelligently
 # check to see if the frr user is in the frrvty
 # group.
-if ! /usr/bin/id frr | grep &>/dev/null 'frrvty'; then
+if ! id frr | grep &>/dev/null 'frrvty'; then
     usermod -a -G frrvty frr >/dev/null
 fi
 
index 04d28762aa49a378971b25d31285337fd9f288ea..a6a9077da181cafa2568b0c82beab6c725bb6650 100755 (executable)
@@ -190,7 +190,7 @@ override_dh_systemd_enable:
 
 # backports
 SRCPKG = frr
-KNOWN_BACKPORTS = debian8 debian9 ubuntu12.04 ubuntu14.04 ubuntu16.04
+KNOWN_BACKPORTS = debian8 debian9 ubuntu12.04 ubuntu14.04 ubuntu16.04 ubuntu17.10
 DEBIAN_VERSION := $(shell dh_testdir && \
                dpkg-parsechangelog -c1 < debian/changelog | \
                sed -rn 's/^Version: ?//p')
index 253617e9b5271ebb1dc2652e27553829f15166c6..723237ebb8c32c78c996fd024e235af6270bd161 100644 (file)
@@ -210,7 +210,7 @@ all DEFPY statements**:
 
 ...
 
-#include "filename_clippy.c"
+#include "daemon/filename_clippy.c"
 
 DEFPY(...)
 DEFPY(...)
index ee4f0843b7d7079095720e4b8f870c3d08dc70ca..39e20ef7c84d467d2b2081af8823653be3a0df29 100644 (file)
@@ -47,58 +47,58 @@ ldp_vty_debug(struct vty *vty, const char *negate, const char *type_str,
 
                if (dir_str[0] == 'r') {
                        if (negate)
-                               DEBUG_OFF(hello, HELLO_RECV);
+                               DEBUG_OFF(hello, LDP_DEBUG_HELLO_RECV);
                        else
-                               DEBUG_ON(hello, HELLO_RECV);
+                               DEBUG_ON(hello, LDP_DEBUG_HELLO_RECV);
                } else {
                        if (negate)
-                               DEBUG_OFF(hello, HELLO_SEND);
+                               DEBUG_OFF(hello, LDP_DEBUG_HELLO_SEND);
                        else
-                               DEBUG_ON(hello, HELLO_SEND);
+                               DEBUG_ON(hello, LDP_DEBUG_HELLO_SEND);
                }
        } else if (strcmp(type_str, "errors") == 0) {
                if (negate)
-                       DEBUG_OFF(errors, ERRORS);
+                       DEBUG_OFF(errors, LDP_DEBUG_ERRORS);
                else
-                       DEBUG_ON(errors, ERRORS);
+                       DEBUG_ON(errors, LDP_DEBUG_ERRORS);
        } else if (strcmp(type_str, "event") == 0) {
                if (negate)
-                       DEBUG_OFF(event, EVENT);
+                       DEBUG_OFF(event, LDP_DEBUG_EVENT);
                else
-                       DEBUG_ON(event, EVENT);
+                       DEBUG_ON(event, LDP_DEBUG_EVENT);
        } else if (strcmp(type_str, "labels") == 0) {
                if (negate)
-                       DEBUG_OFF(labels, LABELS);
+                       DEBUG_OFF(labels, LDP_DEBUG_LABELS);
                else
-                       DEBUG_ON(labels, LABELS);
+                       DEBUG_ON(labels, LDP_DEBUG_LABELS);
        } else if (strcmp(type_str, "messages") == 0) {
                if (dir_str == NULL)
                        return (CMD_WARNING_CONFIG_FAILED);
 
                if (dir_str[0] == 'r') {
                        if (negate) {
-                               DEBUG_OFF(msg, MSG_RECV);
-                               DEBUG_OFF(msg, MSG_RECV_ALL);
+                               DEBUG_OFF(msg, LDP_DEBUG_MSG_RECV);
+                               DEBUG_OFF(msg, LDP_DEBUG_MSG_RECV_ALL);
                        } else {
-                               DEBUG_ON(msg, MSG_RECV);
+                               DEBUG_ON(msg, LDP_DEBUG_MSG_RECV);
                                if (all)
-                                       DEBUG_ON(msg, MSG_RECV_ALL);
+                                       DEBUG_ON(msg, LDP_DEBUG_MSG_RECV_ALL);
                        }
                } else {
                        if (negate) {
-                               DEBUG_OFF(msg, MSG_SEND);
-                               DEBUG_OFF(msg, MSG_SEND_ALL);
+                               DEBUG_OFF(msg, LDP_DEBUG_MSG_SEND);
+                               DEBUG_OFF(msg, LDP_DEBUG_MSG_SEND_ALL);
                        } else {
-                               DEBUG_ON(msg, MSG_SEND);
+                               DEBUG_ON(msg, LDP_DEBUG_MSG_SEND);
                                if (all)
-                                       DEBUG_ON(msg, MSG_SEND_ALL);
+                                       DEBUG_ON(msg, LDP_DEBUG_MSG_SEND_ALL);
                        }
                }
        } else if (strcmp(type_str, "zebra") == 0) {
                if (negate)
-                       DEBUG_OFF(zebra, ZEBRA);
+                       DEBUG_OFF(zebra, LDP_DEBUG_ZEBRA);
                else
-                       DEBUG_ON(zebra, ZEBRA);
+                       DEBUG_ON(zebra, LDP_DEBUG_ZEBRA);
        }
 
        main_imsg_compose_both(IMSG_DEBUG_UPDATE, &ldp_debug,
@@ -112,27 +112,27 @@ ldp_vty_show_debugging(struct vty *vty)
 {
        vty_out (vty, "LDP debugging status:\n");
 
-       if (LDP_DEBUG(hello, HELLO_RECV))
+       if (LDP_DEBUG(hello, LDP_DEBUG_HELLO_RECV))
                vty_out (vty,"  LDP discovery debugging is on (inbound)\n");
-       if (LDP_DEBUG(hello, HELLO_SEND))
+       if (LDP_DEBUG(hello, LDP_DEBUG_HELLO_SEND))
                vty_out (vty,"  LDP discovery debugging is on (outbound)\n");
-       if (LDP_DEBUG(errors, ERRORS))
+       if (LDP_DEBUG(errors, LDP_DEBUG_ERRORS))
                vty_out (vty, "  LDP errors debugging is on\n");
-       if (LDP_DEBUG(event, EVENT))
+       if (LDP_DEBUG(event, LDP_DEBUG_EVENT))
                vty_out (vty, "  LDP events debugging is on\n");
-       if (LDP_DEBUG(labels, LABELS))
+       if (LDP_DEBUG(labels, LDP_DEBUG_LABELS))
                vty_out (vty, "  LDP labels debugging is on\n");
-       if (LDP_DEBUG(msg, MSG_RECV_ALL))
+       if (LDP_DEBUG(msg, LDP_DEBUG_MSG_RECV_ALL))
                vty_out (vty,
                          "  LDP detailed messages debugging is on (inbound)\n");
-       else if (LDP_DEBUG(msg, MSG_RECV))
+       else if (LDP_DEBUG(msg, LDP_DEBUG_MSG_RECV))
                vty_out (vty,"  LDP messages debugging is on (inbound)\n");
-       if (LDP_DEBUG(msg, MSG_SEND_ALL))
+       if (LDP_DEBUG(msg, LDP_DEBUG_MSG_SEND_ALL))
                vty_out (vty,
                          "  LDP detailed messages debugging is on (outbound)\n");
-       else if (LDP_DEBUG(msg, MSG_SEND))
+       else if (LDP_DEBUG(msg, LDP_DEBUG_MSG_SEND))
                vty_out (vty,"  LDP messages debugging is on (outbound)\n");
-       if (LDP_DEBUG(zebra, ZEBRA))
+       if (LDP_DEBUG(zebra, LDP_DEBUG_ZEBRA))
                vty_out (vty, "  LDP zebra debugging is on\n");
        vty_out (vty, "\n");
 
@@ -144,48 +144,48 @@ ldp_debug_config_write(struct vty *vty)
 {
        int write = 0;
 
-       if (CONF_LDP_DEBUG(hello, HELLO_RECV)) {
+       if (CONF_LDP_DEBUG(hello, LDP_DEBUG_HELLO_RECV)) {
                vty_out (vty,"debug mpls ldp discovery hello recv\n");
                write = 1;
        }
 
-       if (CONF_LDP_DEBUG(hello, HELLO_SEND)) {
+       if (CONF_LDP_DEBUG(hello, LDP_DEBUG_HELLO_SEND)) {
                vty_out (vty,"debug mpls ldp discovery hello sent\n");
                write = 1;
        }
 
-       if (CONF_LDP_DEBUG(errors, ERRORS)) {
+       if (CONF_LDP_DEBUG(errors, LDP_DEBUG_ERRORS)) {
                vty_out (vty, "debug mpls ldp errors\n");
                write = 1;
        }
 
-       if (CONF_LDP_DEBUG(event, EVENT)) {
+       if (CONF_LDP_DEBUG(event, LDP_DEBUG_EVENT)) {
                vty_out (vty, "debug mpls ldp event\n");
                write = 1;
        }
 
-       if (CONF_LDP_DEBUG(labels, LABELS)) {
+       if (CONF_LDP_DEBUG(labels, LDP_DEBUG_LABELS)) {
                vty_out (vty, "debug mpls ldp labels\n");
                write = 1;
        }
 
-       if (CONF_LDP_DEBUG(msg, MSG_RECV_ALL)) {
+       if (CONF_LDP_DEBUG(msg, LDP_DEBUG_MSG_RECV_ALL)) {
                vty_out (vty, "debug mpls ldp messages recv all\n");
                write = 1;
-       } else if (CONF_LDP_DEBUG(msg, MSG_RECV)) {
+       } else if (CONF_LDP_DEBUG(msg, LDP_DEBUG_MSG_RECV)) {
                vty_out (vty, "debug mpls ldp messages recv\n");
                write = 1;
        }
 
-       if (CONF_LDP_DEBUG(msg, MSG_SEND_ALL)) {
+       if (CONF_LDP_DEBUG(msg, LDP_DEBUG_MSG_SEND_ALL)) {
                vty_out (vty, "debug mpls ldp messages sent all\n");
                write = 1;
-       } else if (CONF_LDP_DEBUG(msg, MSG_SEND)) {
+       } else if (CONF_LDP_DEBUG(msg, LDP_DEBUG_MSG_SEND)) {
                vty_out (vty, "debug mpls ldp messages sent\n");
                write = 1;
        }
 
-       if (CONF_LDP_DEBUG(zebra, ZEBRA)) {
+       if (CONF_LDP_DEBUG(zebra, LDP_DEBUG_ZEBRA)) {
                vty_out (vty, "debug mpls ldp zebra\n");
                write = 1;
        }
index a0972cea8e663b04cdc93b087dc8e0f928f52420..8ae144d93a3d6c9cac298c9220471bc16cd47bf3 100644 (file)
@@ -46,11 +46,11 @@ struct ldp_debug {
 extern struct ldp_debug         conf_ldp_debug;
 extern struct ldp_debug         ldp_debug;
 
-#define CONF_DEBUG_ON(a, b)    (conf_ldp_debug.a |= (LDP_DEBUG_ ## b))
-#define CONF_DEBUG_OFF(a, b)   (conf_ldp_debug.a &= ~(LDP_DEBUG_ ## b))
+#define CONF_DEBUG_ON(a, b)    (conf_ldp_debug.a |= (b))
+#define CONF_DEBUG_OFF(a, b)   (conf_ldp_debug.a &= ~(b))
 
-#define TERM_DEBUG_ON(a, b)    (ldp_debug.a |= (LDP_DEBUG_ ## b))
-#define TERM_DEBUG_OFF(a, b)   (ldp_debug.a &= ~(LDP_DEBUG_ ## b))
+#define TERM_DEBUG_ON(a, b)    (ldp_debug.a |= (b))
+#define TERM_DEBUG_OFF(a, b)   (ldp_debug.a &= ~(b))
 
 #define DEBUG_ON(a, b)                 \
     do {                               \
@@ -66,48 +66,48 @@ extern struct ldp_debug      ldp_debug;
        TERM_DEBUG_OFF(a, b);           \
     } while (0)
 
-#define LDP_DEBUG(a, b)                (ldp_debug.a & LDP_DEBUG_ ## b)
-#define CONF_LDP_DEBUG(a, b)    (conf_ldp_debug.a & LDP_DEBUG_ ## b)
+#define LDP_DEBUG(a, b)                (ldp_debug.a & b)
+#define CONF_LDP_DEBUG(a, b)    (conf_ldp_debug.a & b)
 
 #define                 debug_hello_recv(emsg, ...)                            \
 do {                                                                   \
-       if (LDP_DEBUG(hello, HELLO_RECV))                               \
+       if (LDP_DEBUG(hello, LDP_DEBUG_HELLO_RECV))                     \
                log_debug("discovery[recv]: " emsg, __VA_ARGS__);       \
 } while (0)
 
 #define                 debug_hello_send(emsg, ...)                            \
 do {                                                                   \
-       if (LDP_DEBUG(hello, HELLO_SEND))                               \
+       if (LDP_DEBUG(hello, LDP_DEBUG_HELLO_SEND))                     \
                log_debug("discovery[send]: " emsg, __VA_ARGS__);       \
 } while (0)
 
 #define                 debug_err(emsg, ...)                                   \
 do {                                                                   \
-       if (LDP_DEBUG(errors, ERRORS))                                  \
+       if (LDP_DEBUG(errors, LDP_DEBUG_ERRORS))                        \
                log_debug("error: " emsg, __VA_ARGS__);                 \
 } while (0)
 
 #define                 debug_evt(emsg, ...)                                   \
 do {                                                                   \
-       if (LDP_DEBUG(event, EVENT))                                    \
+       if (LDP_DEBUG(event, LDP_DEBUG_EVENT))                          \
                log_debug("event: " emsg, __VA_ARGS__);                 \
 } while (0)
 
 #define                 debug_labels(emsg, ...)                                \
 do {                                                                   \
-       if (LDP_DEBUG(labels, LABELS))                                  \
+       if (LDP_DEBUG(labels, LDP_DEBUG_LABELS))                        \
                log_debug("labels: " emsg, __VA_ARGS__);                \
 } while (0)
 
 #define                 debug_msg_recv(emsg, ...)                              \
 do {                                                                   \
-       if (LDP_DEBUG(msg, MSG_RECV))                                   \
+       if (LDP_DEBUG(msg, LDP_DEBUG_MSG_RECV))                         \
                log_debug("msg[in]: " emsg, __VA_ARGS__);               \
 } while (0)
 
 #define                 debug_msg_send(emsg, ...)                              \
 do {                                                                   \
-       if (LDP_DEBUG(msg, MSG_SEND))                                   \
+       if (LDP_DEBUG(msg, LDP_DEBUG_MSG_SEND))                         \
                log_debug("msg[out]: " emsg, __VA_ARGS__);              \
 } while (0)
 
@@ -121,25 +121,25 @@ do {                                                                      \
 
 #define                 debug_kalive_recv(emsg, ...)                           \
 do {                                                                   \
-       if (LDP_DEBUG(msg, MSG_RECV_ALL))                               \
+       if (LDP_DEBUG(msg, LDP_DEBUG_MSG_RECV_ALL))                     \
                log_debug("kalive[in]: " emsg, __VA_ARGS__);            \
 } while (0)
 
 #define                 debug_kalive_send(emsg, ...)                           \
 do {                                                                   \
-       if (LDP_DEBUG(msg, MSG_SEND_ALL))                               \
+       if (LDP_DEBUG(msg, LDP_DEBUG_MSG_SEND_ALL))                     \
                log_debug("kalive[out]: " emsg, __VA_ARGS__);           \
 } while (0)
 
 #define                 debug_zebra_in(emsg, ...)                              \
 do {                                                                   \
-       if (LDP_DEBUG(zebra, ZEBRA))                                    \
+       if (LDP_DEBUG(zebra, LDP_DEBUG_ZEBRA))                          \
                log_debug("zebra[in]: " emsg, __VA_ARGS__);             \
 } while (0)
 
 #define                 debug_zebra_out(emsg, ...)                             \
 do {                                                                   \
-       if (LDP_DEBUG(zebra, ZEBRA))                                    \
+       if (LDP_DEBUG(zebra, LDP_DEBUG_ZEBRA))                          \
                log_debug("zebra[out]: " emsg, __VA_ARGS__);            \
 } while (0)
 
index db71cee618bd8434cf2ddeb402b39fa3582f9894..2d87be0cda80e7d92279cc76df48f1c3d23e98ec 100644 (file)
@@ -38,6 +38,7 @@ ldpd_libldp_a_SOURCES = \
        ldpd/util.c \
        # end
 
+ldpd/ldp_vty_cmds_clippy.c: $(CLIPPY_DEPS)
 ldpd/ldp_vty_cmds.$(OBJEXT): ldpd/ldp_vty_cmds_clippy.c
 
 noinst_HEADERS += \
index 27d0fe402997ca25c1b4ad84bd5bf3aa6b12dc6e..e6a5eae2e2bba4306026e6de5c9f33643cb57943 100644 (file)
--- a/lib/csv.c
+++ b/lib/csv.c
@@ -424,7 +424,7 @@ void csv_clone_record(csv_t *csv, csv_record_t *in_rec, csv_record_t **out_rec)
 
 void csv_remove_record(csv_t *csv, csv_record_t *rec)
 {
-       csv_field_t *fld, *p_fld;
+       csv_field_t *fld = NULL, *p_fld;
 
        /* first check if rec belongs to this csv */
        if (!csv_is_record_valid(csv, rec)) {
index 3c491d6a3b43774383f9599dc7e2c8f054c9fe12..a95749cf0ed7fc616472d2110b768d58463482f8 100644 (file)
@@ -1321,7 +1321,7 @@ static int vty_clear_prefix_list(struct vty *vty, afi_t afi, const char *name,
 }
 
 #ifndef VTYSH_EXTRACT_PL
-#include "plist_clippy.c"
+#include "lib/plist_clippy.c"
 #endif
 
 DEFPY (ip_prefix_list,
index e881d49225e48a8f8beeb1513ef6cfb3d079080e..28d26149e5d39afc6f3107c67d8a49d0d4333266 100644 (file)
@@ -223,6 +223,25 @@ int ptm_lib_init_msg(ptm_lib_handle_t *hdl, int cmd_id, int type, void *in_ctxt,
        return 0;
 }
 
+int ptm_lib_cleanup_msg(ptm_lib_handle_t *hdl, void *ctxt)
+{
+       ptm_lib_msg_ctxt_t *p_ctxt = ctxt;
+       csv_t *csv;
+
+       if (!p_ctxt) {
+               ERRLOG("%s: no context \n", __FUNCTION__);
+               return -1;
+       }
+
+       csv = p_ctxt->csv;
+
+       csv_clean(csv);
+       csv_free(csv);
+       free(p_ctxt);
+
+       return 0;
+}
+
 int ptm_lib_complete_msg(ptm_lib_handle_t *hdl, void *ctxt, char *buf, int *len)
 {
        ptm_lib_msg_ctxt_t *p_ctxt = ctxt;
index bc8fe4ac54d3f1ad7c52130d7673c0f7e8aaefa4..fc4d520dcb41b4c188d9340c7ee5a5edf96cc67b 100644 (file)
@@ -63,5 +63,6 @@ int ptm_lib_find_key_in_msg(void *, const char *, char *);
 int ptm_lib_init_msg(ptm_lib_handle_t *, int, int, void *, void **);
 int ptm_lib_append_msg(ptm_lib_handle_t *, void *, const char *, const char *);
 int ptm_lib_complete_msg(ptm_lib_handle_t *, void *, char *, int *);
+int ptm_lib_cleanup_msg(ptm_lib_handle_t *, void *);
 
 #endif
index 3c77c483ea07ea18fb26b930da75db9faf2923fa..281757222dd1d1b595ef7083af19a4144ab84062 100644 (file)
@@ -241,18 +241,25 @@ int ospf6_route_cmp_nexthops(struct ospf6_route *a, struct ospf6_route *b)
 {
        struct listnode *anode, *bnode;
        struct ospf6_nexthop *anh, *bnh;
+       bool identical = false;
 
        if (a && b) {
                if (listcount(a->nh_list) == listcount(b->nh_list)) {
                        for (ALL_LIST_ELEMENTS_RO(a->nh_list, anode, anh)) {
+                               identical = false;
                                for (ALL_LIST_ELEMENTS_RO(b->nh_list, bnode,
-                                                         bnh))
-                                       if (!ospf6_nexthop_is_same(anh, bnh))
-                                               return (1);
+                                                         bnh)) {
+                                       if (ospf6_nexthop_is_same(anh, bnh))
+                                               identical = true;
+                               }
+                               /* Currnet List A element not found List B
+                                * Non-Identical lists return */
+                               if (identical == false)
+                                       return 1;
                        }
-                       return (0);
+                       return 0;
                } else
-                       return (1);
+                       return 1;
        }
        /* One of the routes doesn't exist ? */
        return (1);
@@ -333,9 +340,14 @@ int ospf6_route_get_first_nh_index(struct ospf6_route *route)
 
 static int ospf6_nexthop_cmp(struct ospf6_nexthop *a, struct ospf6_nexthop *b)
 {
-       if ((a)->ifindex == (b)->ifindex &&
-           IN6_ARE_ADDR_EQUAL(&(a)->address, &(b)->address))
+       if (a->ifindex < b->ifindex)
+               return -1;
+       else if (a->ifindex > b->ifindex)
                return 1;
+       else
+               return memcmp(&a->address, &b->address,
+                             sizeof(struct in6_addr));
+
        return 0;
 }
 
index f1848f1eaff99900e1df4687f5e43f2b00ac0430..a5ea14793a8e8ace5237f4f6bc5d970d6fcacc2c 100644 (file)
@@ -187,7 +187,7 @@ static void ospf_show_vrf_name(struct ospf *ospf, struct vty *vty,
 }
 
 #ifndef VTYSH_EXTRACT_PL
-#include "ospf_vty_clippy.c"
+#include "ospfd/ospf_vty_clippy.c"
 #endif
 
 DEFUN_NOSH (router_ospf,
@@ -449,7 +449,7 @@ DEFUN (ospf_passive_interface,
 {
        VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf);
        int idx_ipv4 = 2;
-       struct interface *ifp;
+       struct interface *ifp = NULL;
        struct in_addr addr = {.s_addr = INADDR_ANY};
        int ret;
        struct ospf_if_params *params;
@@ -459,12 +459,13 @@ DEFUN (ospf_passive_interface,
                ospf_passive_interface_default(ospf, OSPF_IF_PASSIVE);
                return CMD_SUCCESS;
        }
+       if (ospf->vrf_id != VRF_UNKNOWN)
+               ifp = if_get_by_name(argv[1]->arg, ospf->vrf_id, 0);
 
-       ifp = if_get_by_name(argv[1]->arg, ospf->vrf_id, 0);
        if (ifp == NULL) {
                vty_out(vty, "interface %s not found.\n",
                        (char *)argv[1]->arg);
-               return CMD_WARNING;
+               return CMD_WARNING_CONFIG_FAILED;
        }
 
        params = IF_DEF_PARAMS(ifp);
@@ -521,7 +522,7 @@ DEFUN (no_ospf_passive_interface,
 {
        VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf);
        int idx_ipv4 = 3;
-       struct interface *ifp;
+       struct interface *ifp = NULL;
        struct in_addr addr = {.s_addr = INADDR_ANY};
        struct ospf_if_params *params;
        int ret;
@@ -532,11 +533,13 @@ DEFUN (no_ospf_passive_interface,
                return CMD_SUCCESS;
        }
 
-       ifp = if_get_by_name(argv[2]->arg, ospf->vrf_id, 0);
+       if (ospf->vrf_id != VRF_UNKNOWN)
+               ifp = if_get_by_name(argv[1]->arg, ospf->vrf_id, 0);
+
        if (ifp == NULL) {
                vty_out(vty, "interface %s not found.\n",
                        (char *)argv[1]->arg);
-               return CMD_WARNING;
+               return CMD_WARNING_CONFIG_FAILED;
        }
 
        params = IF_DEF_PARAMS(ifp);
@@ -9635,30 +9638,27 @@ const char *ospf_int_type_str[] = {"unknown", /* should never be used. */
                                   "virtual-link", /* should never be used. */
                                   "loopback"};
 
-static int config_write_interface_one(struct vty *vty, struct ospf *ospf)
+static int config_write_interface_one(struct vty *vty, struct vrf *vrf)
 {
-       struct vrf *vrf = vrf_lookup_by_id(ospf->vrf_id);
        struct listnode *node;
        struct interface *ifp;
        struct crypt_key *ck;
        struct route_node *rn = NULL;
        struct ospf_if_params *params;
        int write = 0;
+       struct ospf *ospf = vrf->info;
 
        FOR_ALL_INTERFACES (vrf, ifp) {
-               struct vrf *vrf = NULL;
 
                if (memcmp(ifp->name, "VLINK", 5) == 0)
                        continue;
 
-               vrf = vrf_lookup_by_id(ifp->vrf_id);
-
                vty_frame(vty, "!\n");
-               if (ifp->vrf_id == VRF_DEFAULT || vrf == NULL)
+               if (ifp->vrf_id == VRF_DEFAULT)
                        vty_frame(vty, "interface %s\n", ifp->name);
                else
                        vty_frame(vty, "interface %s vrf %s\n",
-                                 ifp->name, vrf->name);
+                               ifp->name, vrf->name);
                if (ifp->desc)
                        vty_out(vty, " description %s\n", ifp->desc);
 
@@ -9670,26 +9670,27 @@ static int config_write_interface_one(struct vty *vty, struct ospf *ospf)
                        /* Interface Network print. */
                        if (OSPF_IF_PARAM_CONFIGURED(params, type)
                            && params->type != OSPF_IFTYPE_LOOPBACK) {
-                               if (params->type != ospf_default_iftype(ifp)) {
+                               if (params->type !=
+                                       ospf_default_iftype(ifp)) {
                                        vty_out(vty, " ip ospf network %s",
                                                ospf_int_type_str
                                                [params->type]);
                                        if (params != IF_DEF_PARAMS(ifp))
                                                vty_out(vty, " %s",
                                                        inet_ntoa(
-                                                                 rn->p.u.prefix4));
+                                                       rn->p.u.prefix4));
                                        vty_out(vty, "\n");
                                }
                        }
 
                        /* OSPF interface authentication print */
                        if (OSPF_IF_PARAM_CONFIGURED(params, auth_type)
-                           && params->auth_type != OSPF_AUTH_NOTSET) {
+                       && params->auth_type != OSPF_AUTH_NOTSET) {
                                const char *auth_str;
 
                                /* Translation tables are not that much help
-                                * here due to syntax
-                                * of the simple option */
+                               * here due to syntax
+                               * of the simple option */
                                switch (params->auth_type) {
 
                                case OSPF_AUTH_NULL:
@@ -9719,7 +9720,7 @@ static int config_write_interface_one(struct vty *vty, struct ospf *ospf)
 
                        /* Simple Authentication Password print. */
                        if (OSPF_IF_PARAM_CONFIGURED(params, auth_simple)
-                           && params->auth_simple[0] != '\0') {
+                               && params->auth_simple[0] != '\0') {
                                vty_out(vty, " ip ospf authentication-key %s",
                                        params->auth_simple);
                                if (params != IF_DEF_PARAMS(ifp))
@@ -9730,21 +9731,23 @@ static int config_write_interface_one(struct vty *vty, struct ospf *ospf)
 
                        /* Cryptographic Authentication Key print. */
                        if (params && params->auth_crypt) {
-                               for (ALL_LIST_ELEMENTS_RO(params->auth_crypt,
-                                                         node, ck)) {
+                               for (ALL_LIST_ELEMENTS_RO(
+                                               params->auth_crypt,
+                                               node, ck)) {
                                        vty_out(vty,
                                                " ip ospf message-digest-key %d md5 %s",
-                                               ck->key_id, ck->auth_key);
+                                               ck->key_id,
+                                               ck->auth_key);
                                        if (params != IF_DEF_PARAMS(ifp))
                                                vty_out(vty, " %s",
-                                                       inet_ntoa(rn->p.u.prefix4));
+                                               inet_ntoa(rn->p.u.prefix4));
                                        vty_out(vty, "\n");
                                }
                        }
 
                        /* Interface Output Cost print. */
                        if (OSPF_IF_PARAM_CONFIGURED(params,
-                                                    output_cost_cmd)) {
+                                            output_cost_cmd)) {
                                vty_out(vty, " ip ospf cost %u",
                                        params->output_cost_cmd);
                                if (params != IF_DEF_PARAMS(ifp))
@@ -9755,7 +9758,8 @@ static int config_write_interface_one(struct vty *vty, struct ospf *ospf)
 
                        /* Hello Interval print. */
                        if (OSPF_IF_PARAM_CONFIGURED(params, v_hello)
-                           && params->v_hello != OSPF_HELLO_INTERVAL_DEFAULT) {
+                               && params->v_hello !=
+                               OSPF_HELLO_INTERVAL_DEFAULT) {
                                vty_out(vty, " ip ospf hello-interval %u",
                                        params->v_hello);
                                if (params != IF_DEF_PARAMS(ifp))
@@ -9767,18 +9771,19 @@ static int config_write_interface_one(struct vty *vty, struct ospf *ospf)
 
                        /* Router Dead Interval print. */
                        if (OSPF_IF_PARAM_CONFIGURED(params, v_wait)
-                           && params->v_wait
-                           != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT) {
+                               && params->v_wait
+                               != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT) {
                                vty_out(vty, " ip ospf dead-interval ");
 
                                /* fast hello ? */
                                if (OSPF_IF_PARAM_CONFIGURED(params,
-                                                            fast_hello))
+                                                    fast_hello))
                                        vty_out(vty,
                                                "minimal hello-multiplier %d",
                                                params->fast_hello);
                                else
-                                       vty_out(vty, "%u", params->v_wait);
+                                       vty_out(vty, "%u",
+                                               params->v_wait);
 
                                if (params != IF_DEF_PARAMS(ifp))
                                        vty_out(vty, " %s",
@@ -9788,8 +9793,8 @@ static int config_write_interface_one(struct vty *vty, struct ospf *ospf)
 
                        /* Router Priority print. */
                        if (OSPF_IF_PARAM_CONFIGURED(params, priority)
-                           && params->priority
-                           != OSPF_ROUTER_PRIORITY_DEFAULT) {
+                               && params->priority
+                               != OSPF_ROUTER_PRIORITY_DEFAULT) {
                                vty_out(vty, " ip ospf priority %u",
                                        params->priority);
                                if (params != IF_DEF_PARAMS(ifp))
@@ -9800,9 +9805,9 @@ static int config_write_interface_one(struct vty *vty, struct ospf *ospf)
 
                        /* Retransmit Interval print. */
                        if (OSPF_IF_PARAM_CONFIGURED(params,
-                                                    retransmit_interval)
-                           && params->retransmit_interval
-                           != OSPF_RETRANSMIT_INTERVAL_DEFAULT) {
+                                            retransmit_interval)
+                               && params->retransmit_interval
+                               != OSPF_RETRANSMIT_INTERVAL_DEFAULT) {
                                vty_out(vty, " ip ospf retransmit-interval %u",
                                        params->retransmit_interval);
                                if (params != IF_DEF_PARAMS(ifp))
@@ -9812,20 +9817,21 @@ static int config_write_interface_one(struct vty *vty, struct ospf *ospf)
                        }
 
                        /* Transmit Delay print. */
-                       if (OSPF_IF_PARAM_CONFIGURED(params, transmit_delay)
-                           && params->transmit_delay
-                           != OSPF_TRANSMIT_DELAY_DEFAULT) {
+                       if (OSPF_IF_PARAM_CONFIGURED(params,
+                                                    transmit_delay)
+                               && params->transmit_delay
+                               != OSPF_TRANSMIT_DELAY_DEFAULT) {
                                vty_out(vty, " ip ospf transmit-delay %u",
                                        params->transmit_delay);
                                if (params != IF_DEF_PARAMS(ifp))
                                        vty_out(vty, " %s",
-                                               inet_ntoa(rn->p.u.prefix4));
+                                       inet_ntoa(rn->p.u.prefix4));
                                vty_out(vty, "\n");
                        }
 
                        /* Area  print. */
                        if (OSPF_IF_PARAM_CONFIGURED(params, if_area)) {
-                               if (ospf->instance)
+                               if (ospf && ospf->instance)
                                        vty_out(vty, " ip ospf %d",
                                                ospf->instance);
                                else
@@ -9833,39 +9839,42 @@ static int config_write_interface_one(struct vty *vty, struct ospf *ospf)
 
 
                                size_t buflen = MAX(strlen("4294967295"),
-                                                   strlen("255.255.255.255"));
+                                           strlen("255.255.255.255"));
                                char buf[buflen];
 
                                area_id2str(buf, sizeof(buf),
                                            &params->if_area,
-                                           params->if_area_id_fmt);
+                                               params->if_area_id_fmt);
                                vty_out(vty, " area %s", buf);
                                if (params != IF_DEF_PARAMS(ifp))
                                        vty_out(vty, " %s",
-                                               inet_ntoa(rn->p.u.prefix4));
+                                       inet_ntoa(rn->p.u.prefix4));
                                vty_out(vty, "\n");
                        }
 
                        /* bfd  print. */
-                       ospf_bfd_write_config(vty, params);
+                       if (params->bfd_info)
+                               ospf_bfd_write_config(vty, params);
 
                        /* MTU ignore print. */
                        if (OSPF_IF_PARAM_CONFIGURED(params, mtu_ignore)
-                           && params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT) {
+                               && params->mtu_ignore !=
+                               OSPF_MTU_IGNORE_DEFAULT) {
                                if (params->mtu_ignore == 0)
                                        vty_out(vty, " no ip ospf mtu-ignore");
                                else
                                        vty_out(vty, " ip ospf mtu-ignore");
                                if (params != IF_DEF_PARAMS(ifp))
                                        vty_out(vty, " %s",
-                                               inet_ntoa(rn->p.u.prefix4));
+                                       inet_ntoa(rn->p.u.prefix4));
                                vty_out(vty, "\n");
                        }
 
 
                        while (1) {
                                if (rn == NULL)
-                                       rn = route_top(IF_OIFS_PARAMS(ifp));
+                                       rn = route_top(
+                                               IF_OIFS_PARAMS(ifp));
                                else
                                        rn = route_next(rn);
 
@@ -9881,6 +9890,7 @@ static int config_write_interface_one(struct vty *vty, struct ospf *ospf)
 
                vty_endframe(vty, NULL);
        }
+
        return write;
 }
 
@@ -9888,12 +9898,12 @@ static int config_write_interface_one(struct vty *vty, struct ospf *ospf)
 static int config_write_interface(struct vty *vty)
 {
        int write = 0;
-       struct ospf *ospf = NULL;
-       struct listnode *node = NULL;
+       struct vrf *vrf = NULL;
 
-       /* Traverse all ospf [vrf] instances */
-       for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf))
-               write += config_write_interface_one(vty, ospf);
+       /* Display all VRF aware OSPF interface configuration */
+       RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
+               write += config_write_interface_one(vty, vrf);
+       }
 
        return write;
 }
index 47bb37ce929f093d9077e832c9b03fe0d5793d3b..a35157faa19ef82dce174acb2a15b7b9ddeaa8f4 100644 (file)
@@ -29,7 +29,9 @@
 
 #include "sharpd/sharp_zebra.h"
 #include "sharpd/sharp_vty.h"
+#ifndef VTYSH_EXTRACT_PL
 #include "sharpd/sharp_vty_clippy.c"
+#endif
 
 extern uint32_t total_routes;
 extern uint32_t installed_routes;
index 33106bdf15b28457205017837e72b52da3e73c95..dc3dcbf1e94096b58bf7433ff2279684bdde0b8b 100644 (file)
@@ -596,7 +596,8 @@ static void daemon_send_ready(void)
                FILE *fp;
 
                fp = fopen(DAEMON_VTY_DIR "/watchfrr.started", "w");
-               fclose(fp);
+               if (fp)
+                       fclose(fp);
 #if defined HAVE_SYSTEMD
                zlog_notice(
                        "Watchfrr: Notifying Systemd we are up and running");
index 6bc05e21c5d08c9da870416cada92a11c7f03273..f095a32d1ecabed2dd8bea6acd8d2777d749d5cc 100644 (file)
@@ -170,7 +170,12 @@ struct rtadvconf {
 #define RTADV_PREF_MEDIUM 0x0 /* Per RFC4191. */
 
        u_char inFastRexmit; /* True if we're rexmits faster than usual */
-       u_char configured;   /* Has operator configured RA? */
+
+       /* Track if RA was configured by BGP or by the Operator or both */
+       u_char ra_configured;     /* Was RA configured? */
+#define BGP_RA_CONFIGURED (1<<0)  /* BGP configured RA? */
+#define VTY_RA_CONFIGURED (1<<1)  /* Operator configured RA? */
+#define VTY_RA_INTERVAL_CONFIGURED (1<<2)  /* Operator configured RA interval */
        int
                NumFastReXmitsRemain; /* Loaded first with number of fast
                                         rexmits to do */
index 2834eeeb9cc51f62921c9f95796f21030a56b481..f823ec4384c9eedea0efa81b1029a41b33eaca1d 100644 (file)
@@ -42,6 +42,7 @@ static void dropline(FILE *fp)
 
 int ipforward(void)
 {
+       int ret = 0;
        FILE *fp;
        int ipforwarding = 0;
        char buf[10];
@@ -58,11 +59,11 @@ int ipforward(void)
           1 => ip forwarding enabled
           2 => ip forwarding off. */
        if (fgets(buf, 6, fp))
-               sscanf(buf, "Ip: %d", &ipforwarding);
+               ret = sscanf(buf, "Ip: %d", &ipforwarding);
 
        fclose(fp);
 
-       if (ipforwarding == 1)
+       if (ret == 1 && ipforwarding == 1)
                return 1;
 
        return 0;
@@ -127,6 +128,7 @@ char proc_ipv6_forwarding[] = "/proc/sys/net/ipv6/conf/all/forwarding";
 
 int ipforward_ipv6(void)
 {
+       int ret = 0;
        FILE *fp;
        char buf[5];
        int ipforwarding = 0;
@@ -137,9 +139,13 @@ int ipforward_ipv6(void)
                return -1;
 
        if (fgets(buf, 2, fp))
-               sscanf(buf, "%d", &ipforwarding);
+               ret = sscanf(buf, "%d", &ipforwarding);
 
        fclose(fp);
+
+       if (ret != 1)
+               return 0;
+
        return ipforwarding;
 }
 
index 61beebb40938a80a09b155c469d18347ba1c85c6..818844cb6d55e345a1f686eb7d3f2cad455dba8c 100644 (file)
@@ -285,9 +285,9 @@ extern int zebra_check_addr(struct prefix *p);
 extern void rib_addnode(struct route_node *rn, struct route_entry *re,
                        int process);
 extern void rib_delnode(struct route_node *rn, struct route_entry *re);
-extern int rib_install_kernel(struct route_node *rn, struct route_entry *re,
-                             struct route_entry *old);
-extern int rib_uninstall_kernel(struct route_node *rn, struct route_entry *re);
+extern void rib_install_kernel(struct route_node *rn, struct route_entry *re,
+                              struct route_entry *old);
+extern void rib_uninstall_kernel(struct route_node *rn, struct route_entry *re);
 
 /* NOTE:
  * All rib_add function will not just add prefix into RIB, but
index 3ce15e964022377ebe00f4d4e0ab6bd50a047387..6bbe69e983390ae25f17e01e99bedd00dc87f73b 100644 (file)
  * success failure should be handled by the caller.
  */
 
-extern int kernel_route_rib(struct prefix *, struct prefix *,
-                           struct route_entry *, struct route_entry *);
+
+enum southbound_results {
+       SOUTHBOUND_INSTALL_SUCCESS,
+       SOUTHBOUND_INSTALL_FAILURE,
+       SOUTHBOUND_DELETE_SUCCESS,
+       SOUTHBOUND_DELETE_FAILURE,
+};
+
+/*
+ * Install/delete the specified prefix p from the kernel
+ *
+ * old = NULL, new = pointer - Install new
+ * old = pointer, new = pointer - Route replace Old w/ New
+ * old = pointer, new = NULL, - Route Delete
+ *
+ * Please note not all kernels support route replace
+ * semantics so we will end up with a delete than
+ * a re-add.
+ */
+extern void kernel_route_rib(struct prefix *p, struct prefix *src_p,
+                            struct route_entry *old, struct route_entry *new);
+
+/*
+ * So route install/failure may not be immediately known
+ * so let's separate it out and allow the result to
+ * be passed back up.
+ */
+extern void kernel_route_rib_pass_fail(struct prefix *p,
+                                      struct route_entry *re,
+                                      enum southbound_results res);
 
 extern int kernel_address_add_ipv4(struct interface *, struct connected *);
 extern int kernel_address_delete_ipv4(struct interface *, struct connected *);
 extern int kernel_neigh_update(int, int, uint32_t, char *, int);
 extern int kernel_interface_set_master(struct interface *master,
                                       struct interface *slave);
-extern int kernel_add_lsp(zebra_lsp_t *);
-extern int kernel_upd_lsp(zebra_lsp_t *);
-extern int kernel_del_lsp(zebra_lsp_t *);
+
+extern void kernel_add_lsp(zebra_lsp_t *lsp);
+extern void kernel_upd_lsp(zebra_lsp_t *lsp);
+extern void kernel_del_lsp(zebra_lsp_t *lsp);
+
+/*
+ * Add the ability to pass back up the lsp install/delete
+ * success/failure.
+ *
+ * This functions goal is similiar to kernel_route_rib_pass_fail
+ * in that we are separating out the mechanics for
+ * the install/failure to set/unset flags and to notify
+ * as needed.
+ */
+extern void kernel_lsp_pass_fail(zebra_lsp_t *lsp,
+                                enum southbound_results res);
+
 extern int mpls_kernel_init(void);
 
 extern int kernel_get_ipmr_sg_stats(struct zebra_vrf *zvrf, void *mroute);
index 3830e1fbdefbe24302ee474682906c1729422dbf..cbe736e00cc1c06bd3ce98b9c01c5603d8bd18b8 100644 (file)
@@ -1598,33 +1598,51 @@ int kernel_get_ipmr_sg_stats(struct zebra_vrf *zvrf, void *in)
        return suc;
 }
 
-int kernel_route_rib(struct prefix *p, struct prefix *src_p,
-                    struct route_entry *old, struct route_entry *new)
+void kernel_route_rib(struct prefix *p, struct prefix *src_p,
+                     struct route_entry *old, struct route_entry *new)
 {
+       int ret = 0;
+
        assert(old || new);
 
-       if (!old && new)
-               return netlink_route_multipath(RTM_NEWROUTE, p, src_p, new, 0);
-       if (old && !new)
-               return netlink_route_multipath(RTM_DELROUTE, p, src_p, old, 0);
+       if (new) {
+               if (p->family == AF_INET)
+                       ret = netlink_route_multipath(RTM_NEWROUTE, p, src_p,
+                                                     new, (old) ? 1 : 0);
+               else {
+                       /*
+                        * So v6 route replace semantics are not in
+                        * the kernel at this point as I understand it.
+                        * So let's do a delete than an add.
+                        * In the future once v6 route replace semantics
+                        * are in we can figure out what to do here to
+                        * allow working with old and new kernels.
+                        *
+                        * I'm also intentionally ignoring the failure case
+                        * of the route delete.  If that happens yeah we're
+                        * screwed.
+                        */
+                       if (old)
+                               netlink_route_multipath(RTM_DELROUTE, p,
+                                                       src_p, old, 0);
+                       ret = netlink_route_multipath(RTM_NEWROUTE, p,
+                                                     src_p, new, 0);
+               }
+               kernel_route_rib_pass_fail(p, new,
+                                          (!ret) ?
+                                          SOUTHBOUND_INSTALL_SUCCESS :
+                                          SOUTHBOUND_INSTALL_FAILURE);
+               return;
+       }
 
-       if (p->family == AF_INET)
-               return netlink_route_multipath(RTM_NEWROUTE, p, src_p, new, 1);
+       if (old) {
+               ret = netlink_route_multipath(RTM_DELROUTE, p, src_p, old, 0);
 
-       /*
-        * So v6 route replace semantics are not in the kernel at this
-        * point as I understand it.
-        * So let's do a delete than an add.
-        * In the future once v6 route replace semantics are in
-        * we can figure out what to do here to allow working
-        * with old and new kernels.
-        *
-        * I'm also intentionally ignoring the failure case
-        * of the route delete.  If that happens yeah we're
-        * screwed.
-        */
-       netlink_route_multipath(RTM_DELROUTE, p, src_p, old, 0);
-       return netlink_route_multipath(RTM_NEWROUTE, p, src_p, new, 0);
+               kernel_route_rib_pass_fail(p, old,
+                                          (!ret) ?
+                                          SOUTHBOUND_DELETE_SUCCESS :
+                                          SOUTHBOUND_DELETE_FAILURE);
+       }
 }
 
 int kernel_neigh_update(int add, int ifindex, uint32_t addr, char *lla,
@@ -2414,17 +2432,6 @@ int netlink_mpls_multipath(int cmd, zebra_lsp_t *lsp)
                                _netlink_mpls_build_singlepath(routedesc, nhlfe,
                                                               &req.n, &req.r,
                                                               sizeof req, cmd);
-                               if (cmd == RTM_NEWROUTE) {
-                                       SET_FLAG(nhlfe->flags,
-                                                NHLFE_FLAG_INSTALLED);
-                                       SET_FLAG(nexthop->flags,
-                                                NEXTHOP_FLAG_FIB);
-                               } else {
-                                       UNSET_FLAG(nhlfe->flags,
-                                                  NHLFE_FLAG_INSTALLED);
-                                       UNSET_FLAG(nexthop->flags,
-                                                  NEXTHOP_FLAG_FIB);
-                               }
                                nexthop_num++;
                                break;
                        }
@@ -2468,18 +2475,6 @@ int netlink_mpls_multipath(int cmd, zebra_lsp_t *lsp)
                                                              rta, rtnh, &req.r,
                                                              &src1);
                                rtnh = RTNH_NEXT(rtnh);
-
-                               if (cmd == RTM_NEWROUTE) {
-                                       SET_FLAG(nhlfe->flags,
-                                                NHLFE_FLAG_INSTALLED);
-                                       SET_FLAG(nexthop->flags,
-                                                NEXTHOP_FLAG_FIB);
-                               } else {
-                                       UNSET_FLAG(nhlfe->flags,
-                                                  NHLFE_FLAG_INSTALLED);
-                                       UNSET_FLAG(nexthop->flags,
-                                                  NEXTHOP_FLAG_FIB);
-                               }
                        }
                }
 
index e5887949470d6b8e70dc07ee5aa2601ed4947e90..0d1a80e737b2f0c1cd7072910c32cf64936ac3c9 100644 (file)
@@ -387,14 +387,14 @@ static int kernel_rtm(int cmd, struct prefix *p, struct route_entry *re)
        return 0;
 }
 
-int kernel_route_rib(struct prefix *p, struct prefix *src_p,
-                    struct route_entry *old, struct route_entry *new)
+void kernel_route_rib(struct prefix *p, struct prefix *src_p,
+                     struct route_entry *old, struct route_entry *new)
 {
        int route = 0;
 
        if (src_p && src_p->prefixlen) {
                zlog_err("route add: IPv6 sourcedest routes unsupported!");
-               return 1;
+               return;
        }
 
        if (zserv_privs.change(ZPRIVS_RAISE))
@@ -409,7 +409,17 @@ int kernel_route_rib(struct prefix *p, struct prefix *src_p,
        if (zserv_privs.change(ZPRIVS_LOWER))
                zlog_err("Can't lower privileges");
 
-       return route;
+       if (new) {
+               kernel_route_rib_pass_fail(p, new,
+                                          (!route) ?
+                                          SOUTHBOUND_INSTALL_SUCCESS :
+                                          SOUTHBOUND_INSTALL_FAILURE);
+       } else {
+               kernel_route_rib_pass_fail(p, old,
+                                          (!route) ?
+                                          SOUTHBOUND_DELETE_SUCCESS :
+                                          SOUTHBOUND_DELETE_FAILURE);
+       }
 }
 
 int kernel_neigh_update(int add, int ifindex, uint32_t addr, char *lla,
index 40219599ddac9903e6e912c642ce66b480ccd276..32418eb82fb45498d90d16505209135e1929bc39 100644 (file)
@@ -838,16 +838,21 @@ void zebra_interface_radv_set(struct zserv *client, u_short length,
 
        zif = ifp->info;
        if (enable) {
+               SET_FLAG(zif->rtadv.ra_configured, BGP_RA_CONFIGURED);
                ipv6_nd_suppress_ra_set(ifp, RA_ENABLE);
                if (ra_interval
-                   && (ra_interval * 1000) < zif->rtadv.MaxRtrAdvInterval)
+                       && (ra_interval * 1000) < zif->rtadv.MaxRtrAdvInterval
+                       && !CHECK_FLAG(zif->rtadv.ra_configured,
+                               VTY_RA_INTERVAL_CONFIGURED))
                        zif->rtadv.MaxRtrAdvInterval = ra_interval * 1000;
        } else {
-               if (!zif->rtadv.configured) {
+               UNSET_FLAG(zif->rtadv.ra_configured, BGP_RA_CONFIGURED);
+               if (!CHECK_FLAG(zif->rtadv.ra_configured,
+                               VTY_RA_INTERVAL_CONFIGURED))
                        zif->rtadv.MaxRtrAdvInterval =
                                RTADV_MAX_RTR_ADV_INTERVAL;
+               if (!CHECK_FLAG(zif->rtadv.ra_configured, VTY_RA_CONFIGURED))
                        ipv6_nd_suppress_ra_set(ifp, RA_SUPPRESS);
-               }
        }
 stream_failure:
        return;
@@ -870,8 +875,10 @@ DEFUN (ipv6_nd_suppress_ra,
                return CMD_WARNING_CONFIG_FAILED;
        }
 
-       ipv6_nd_suppress_ra_set(ifp, RA_SUPPRESS);
-       zif->rtadv.configured = 0;
+       if (!CHECK_FLAG(zif->rtadv.ra_configured, BGP_RA_CONFIGURED))
+               ipv6_nd_suppress_ra_set(ifp, RA_SUPPRESS);
+
+       UNSET_FLAG(zif->rtadv.ra_configured, VTY_RA_CONFIGURED);
        return CMD_SUCCESS;
 }
 
@@ -894,7 +901,7 @@ DEFUN (no_ipv6_nd_suppress_ra,
        }
 
        ipv6_nd_suppress_ra_set(ifp, RA_ENABLE);
-       zif->rtadv.configured = 1;
+       SET_FLAG(zif->rtadv.ra_configured, VTY_RA_CONFIGURED);
        return CMD_SUCCESS;
 }
 
@@ -929,6 +936,7 @@ DEFUN (ipv6_nd_ra_interval_msec,
        if (interval % 1000)
                zns->rtadv.adv_msec_if_count++;
 
+       SET_FLAG(zif->rtadv.ra_configured, VTY_RA_INTERVAL_CONFIGURED);
        zif->rtadv.MaxRtrAdvInterval = interval;
        zif->rtadv.MinRtrAdvInterval = 0.33 * interval;
        zif->rtadv.AdvIntervalTimer = 0;
@@ -966,6 +974,7 @@ DEFUN (ipv6_nd_ra_interval,
        /* convert to milliseconds */
        interval = interval * 1000;
 
+       SET_FLAG(zif->rtadv.ra_configured, VTY_RA_INTERVAL_CONFIGURED);
        zif->rtadv.MaxRtrAdvInterval = interval;
        zif->rtadv.MinRtrAdvInterval = 0.33 * interval;
        zif->rtadv.AdvIntervalTimer = 0;
@@ -995,9 +1004,15 @@ DEFUN (no_ipv6_nd_ra_interval,
        if (zif->rtadv.MaxRtrAdvInterval % 1000)
                zns->rtadv.adv_msec_if_count--;
 
-       zif->rtadv.MaxRtrAdvInterval = RTADV_MAX_RTR_ADV_INTERVAL;
-       zif->rtadv.MinRtrAdvInterval = RTADV_MIN_RTR_ADV_INTERVAL;
+       UNSET_FLAG(zif->rtadv.ra_configured, VTY_RA_INTERVAL_CONFIGURED);
+
+       if (CHECK_FLAG(zif->rtadv.ra_configured, BGP_RA_CONFIGURED))
+               zif->rtadv.MaxRtrAdvInterval = 10000;
+       else
+               zif->rtadv.MaxRtrAdvInterval = RTADV_MAX_RTR_ADV_INTERVAL;
+
        zif->rtadv.AdvIntervalTimer = zif->rtadv.MaxRtrAdvInterval;
+       zif->rtadv.MinRtrAdvInterval = RTADV_MIN_RTR_ADV_INTERVAL;
 
        return CMD_SUCCESS;
 }
@@ -1552,15 +1567,20 @@ static int rtadv_config_write(struct vty *vty, struct interface *ifp)
 
        if (!(if_is_loopback(ifp)
              || CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_VRF_LOOPBACK))) {
-               if (zif->rtadv.AdvSendAdvertisements)
+               if (zif->rtadv.AdvSendAdvertisements
+                   && CHECK_FLAG(zif->rtadv.ra_configured, VTY_RA_CONFIGURED))
                        vty_out(vty, " no ipv6 nd suppress-ra\n");
        }
 
        interval = zif->rtadv.MaxRtrAdvInterval;
-       if (interval % 1000)
-               vty_out(vty, " ipv6 nd ra-interval msec %d\n", interval);
-       else if (interval != RTADV_MAX_RTR_ADV_INTERVAL)
-               vty_out(vty, " ipv6 nd ra-interval %d\n", interval / 1000);
+       if (CHECK_FLAG(zif->rtadv.ra_configured, VTY_RA_INTERVAL_CONFIGURED)) {
+               if (interval % 1000)
+                       vty_out(vty, " ipv6 nd ra-interval msec %d\n",
+                               interval);
+               else if (interval != RTADV_MAX_RTR_ADV_INTERVAL)
+                       vty_out(vty, " ipv6 nd ra-interval %d\n",
+                               interval / 1000);
+       }
 
        if (zif->rtadv.AdvIntervalOption)
                vty_out(vty, " ipv6 nd adv-interval-option\n");
index 320176ba3a97f97942cd1dd041b8d10376721d0e..4c6fb002dca301b069760dc228df4a3020164423 100644 (file)
@@ -839,18 +839,11 @@ static void lsp_select_best_nhlfe(zebra_lsp_t *lsp)
  */
 static void lsp_uninstall_from_kernel(struct hash_backet *backet, void *ctxt)
 {
-       int ret;
        zebra_lsp_t *lsp;
 
        lsp = (zebra_lsp_t *)backet->data;
-       if (CHECK_FLAG(lsp->flags, LSP_FLAG_INSTALLED)) {
-               ret = kernel_del_lsp(lsp);
-
-               if (!ret) {
-                       UNSET_FLAG(lsp->flags, LSP_FLAG_INSTALLED);
-                       clear_nhlfe_installed(lsp);
-               }
-       }
+       if (CHECK_FLAG(lsp->flags, LSP_FLAG_INSTALLED))
+               kernel_del_lsp(lsp);
 }
 
 /*
@@ -871,7 +864,6 @@ static void lsp_schedule(struct hash_backet *backet, void *ctxt)
  */
 static wq_item_status lsp_process(struct work_queue *wq, void *data)
 {
-       int ret = 1;
        zebra_lsp_t *lsp;
        zebra_nhlfe_t *oldbest, *newbest;
        char buf[BUFSIZ], buf2[BUFSIZ];
@@ -905,12 +897,7 @@ static wq_item_status lsp_process(struct work_queue *wq, void *data)
                if (newbest) {
 
                        UNSET_FLAG(lsp->flags, LSP_FLAG_CHANGED);
-                       ret = kernel_add_lsp(lsp);
-
-                       if (!ret)
-                               SET_FLAG(lsp->flags, LSP_FLAG_INSTALLED);
-                       else
-                               clear_nhlfe_installed(lsp);
+                       kernel_add_lsp(lsp);
 
                        zvrf->lsp_installs++;
                }
@@ -918,25 +905,38 @@ static wq_item_status lsp_process(struct work_queue *wq, void *data)
                /* Installed, may need an update and/or delete. */
                if (!newbest) {
 
-                       ret = kernel_del_lsp(lsp);
-
-                       if (!ret) {
-                               UNSET_FLAG(lsp->flags, LSP_FLAG_INSTALLED);
-                               clear_nhlfe_installed(lsp);
-                       }
+                       kernel_del_lsp(lsp);
 
                        zvrf->lsp_removals++;
                } else if (CHECK_FLAG(lsp->flags, LSP_FLAG_CHANGED)) {
+                       zebra_nhlfe_t *nhlfe;
+                       struct nexthop *nexthop;
 
                        UNSET_FLAG(lsp->flags, LSP_FLAG_CHANGED);
                        UNSET_FLAG(lsp->flags, LSP_FLAG_INSTALLED);
 
-                       ret = kernel_upd_lsp(lsp);
+                       /*
+                        * Any NHLFE that was installed but is not
+                        * selected now needs to have its flags updated.
+                        */
+                       for (nhlfe = lsp->nhlfe_list;
+                            nhlfe; nhlfe = nhlfe->next) {
+                               nexthop = nhlfe->nexthop;
+                               if (!nexthop)
+                                       continue;
+
+                               if (CHECK_FLAG(nhlfe->flags,
+                                              NHLFE_FLAG_INSTALLED) &&
+                                   !CHECK_FLAG(nhlfe->flags,
+                                               NHLFE_FLAG_SELECTED)) {
+                                       UNSET_FLAG(nhlfe->flags,
+                                                  NHLFE_FLAG_INSTALLED);
+                                       UNSET_FLAG(nexthop->flags,
+                                                  NEXTHOP_FLAG_FIB);
+                               }
+                       }
 
-                       if (!ret)
-                               SET_FLAG(lsp->flags, LSP_FLAG_INSTALLED);
-                       else
-                               clear_nhlfe_installed(lsp);
+                       kernel_upd_lsp(lsp);
 
                        zvrf->lsp_installs++;
                }
@@ -1659,6 +1659,42 @@ static int mpls_processq_init(struct zebra_t *zebra)
 
 /* Public functions */
 
+void kernel_lsp_pass_fail(zebra_lsp_t *lsp,
+                         enum southbound_results res)
+{
+       struct nexthop *nexthop;
+       zebra_nhlfe_t *nhlfe;
+
+       if (!lsp)
+               return;
+
+       switch (res) {
+       case SOUTHBOUND_INSTALL_FAILURE:
+               UNSET_FLAG(lsp->flags, LSP_FLAG_INSTALLED);
+               clear_nhlfe_installed(lsp);
+               zlog_warn("LSP Install Failure: %u", lsp->ile.in_label);
+               break;
+       case SOUTHBOUND_INSTALL_SUCCESS:
+               SET_FLAG(lsp->flags, LSP_FLAG_INSTALLED);
+               for (nhlfe = lsp->nhlfe_list; nhlfe; nhlfe = nhlfe->next) {
+                       nexthop = nhlfe->nexthop;
+                       if (!nexthop)
+                               continue;
+
+                       SET_FLAG(nhlfe->flags, NHLFE_FLAG_INSTALLED);
+                       SET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
+               }
+               break;
+       case SOUTHBOUND_DELETE_SUCCESS:
+               UNSET_FLAG(lsp->flags, LSP_FLAG_INSTALLED);
+               clear_nhlfe_installed(lsp);
+               break;
+       case SOUTHBOUND_DELETE_FAILURE:
+               zlog_warn("LSP Deletion Failure: %u", lsp->ile.in_label);
+               break;
+       }
+}
+
 /*
  * String to label conversion, labels separated by '/'.
  *
index 0abc4959fa47c42d11779c92502d2f7880c7a515..3c8d25189e98312ff90953e5c757949f1487b7f4 100644 (file)
 /*
  * Install Label Forwarding entry into the kernel.
  */
-int kernel_add_lsp(zebra_lsp_t *lsp)
+void kernel_add_lsp(zebra_lsp_t *lsp)
 {
        int ret;
 
-       if (!lsp || !lsp->best_nhlfe) // unexpected
-               return -1;
+       if (!lsp || !lsp->best_nhlfe) { // unexpected
+               kernel_lsp_pass_fail(lsp, SOUTHBOUND_INSTALL_FAILURE);
+               return;
+       }
 
        ret = netlink_mpls_multipath(RTM_NEWROUTE, lsp);
 
-       return ret;
+       kernel_lsp_pass_fail(lsp,
+                            (!ret) ?
+                            SOUTHBOUND_INSTALL_SUCCESS :
+                            SOUTHBOUND_INSTALL_FAILURE);
 }
 
 /*
@@ -52,51 +57,48 @@ int kernel_add_lsp(zebra_lsp_t *lsp)
  * through the metric field (before kernel-MPLS). This shouldn't be an issue
  * any longer, so REPLACE can be reintroduced.
  */
-int kernel_upd_lsp(zebra_lsp_t *lsp)
+void kernel_upd_lsp(zebra_lsp_t *lsp)
 {
        int ret;
-       zebra_nhlfe_t *nhlfe;
-       struct nexthop *nexthop;
 
-       if (!lsp || !lsp->best_nhlfe) // unexpected
-               return -1;
-
-       /* Any NHLFE that was installed but is not selected now needs to
-        * have its flags updated.
-        */
-       for (nhlfe = lsp->nhlfe_list; nhlfe; nhlfe = nhlfe->next) {
-               nexthop = nhlfe->nexthop;
-               if (!nexthop)
-                       continue;
-
-               if (CHECK_FLAG(nhlfe->flags, NHLFE_FLAG_INSTALLED) &&
-                   !CHECK_FLAG(nhlfe->flags, NHLFE_FLAG_SELECTED)) {
-                       UNSET_FLAG(nhlfe->flags, NHLFE_FLAG_INSTALLED);
-                       UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
-               }
+       if (!lsp || !lsp->best_nhlfe) { // unexpected
+               kernel_lsp_pass_fail(lsp, SOUTHBOUND_INSTALL_FAILURE);
+               return;
        }
 
        ret = netlink_mpls_multipath(RTM_NEWROUTE, lsp);
 
-       return ret;
+       kernel_lsp_pass_fail(lsp,
+                            (!ret) ?
+                            SOUTHBOUND_INSTALL_SUCCESS :
+                            SOUTHBOUND_INSTALL_FAILURE);
 }
 
 /*
  * Delete Label Forwarding entry from the kernel.
  */
-int kernel_del_lsp(zebra_lsp_t *lsp)
+void kernel_del_lsp(zebra_lsp_t *lsp)
 {
        int ret;
 
-       if (!lsp) // unexpected
-               return -1;
+       if (!lsp) { // unexpected
+               kernel_lsp_pass_fail(lsp,
+                                    SOUTHBOUND_DELETE_FAILURE);
+               return;
+       }
 
-       if (!CHECK_FLAG(lsp->flags, LSP_FLAG_INSTALLED))
-               return -1;
+       if (!CHECK_FLAG(lsp->flags, LSP_FLAG_INSTALLED)) {
+               kernel_lsp_pass_fail(lsp,
+                                    SOUTHBOUND_DELETE_FAILURE);
+               return;
+       }
 
        ret = netlink_mpls_multipath(RTM_DELROUTE, lsp);
 
-       return ret;
+       kernel_lsp_pass_fail(lsp,
+                            (!ret) ?
+                            SOUTHBOUND_DELETE_SUCCESS :
+                            SOUTHBOUND_DELETE_FAILURE);
 }
 
 int mpls_kernel_init(void)
index e4dc570fd92a57b2bc9017c7084afbb4ba675ab5..6b5318325d2c64f83aa2b798650f7e392ede3322 100644 (file)
 
 #if !defined(HAVE_NETLINK) && !defined(OPEN_BSD)
 
-int kernel_add_lsp(zebra_lsp_t *lsp)
+void kernel_add_lsp(zebra_lsp_t *lsp)
 {
-       return 0;
+       return;
 }
-int kernel_upd_lsp(zebra_lsp_t *lsp)
+void kernel_upd_lsp(zebra_lsp_t *lsp)
 {
-       return 0;
+       return;
 }
-int kernel_del_lsp(zebra_lsp_t *lsp)
+void kernel_del_lsp(zebra_lsp_t *lsp)
 {
-       return 0;
+       return;
 }
 int mpls_kernel_init(void)
 {
index 44f89f0b3bd5faacdfe99b7fbcafedb21077850c..2fc93893fa0d71d930f131bc7487ff413c0e93d7 100644 (file)
@@ -279,56 +279,69 @@ static int kernel_lsp_cmd(int action, zebra_lsp_t *lsp)
                        default:
                                break;
                        }
-                       if (action == RTM_ADD || action == RTM_CHANGE) {
-                               SET_FLAG(nhlfe->flags, NHLFE_FLAG_INSTALLED);
-                               SET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
-                       } else {
-                               UNSET_FLAG(nhlfe->flags, NHLFE_FLAG_INSTALLED);
-                               UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
-                       }
                }
        }
 
        return (0);
 }
 
-int kernel_add_lsp(zebra_lsp_t *lsp)
+void kernel_add_lsp(zebra_lsp_t *lsp)
 {
        int ret;
 
-       if (!lsp || !lsp->best_nhlfe) // unexpected
-               return -1;
+       if (!lsp || !lsp->best_nhlfe) { // unexpected
+               kernel_lsp_pass_fail(lsp, SOUTHBOUND_INSTALL_FAILURE);
+               return;
+       }
 
        ret = kernel_lsp_cmd(RTM_ADD, lsp);
 
-       return ret;
+       kernel_lsp_pass_fail(lsp,
+                            (!ret) ?
+                            SOUTHBOUND_INSTALL_SUCCESS :
+                            SOUTHBOUND_INSTALL_FAILURE);
 }
 
-int kernel_upd_lsp(zebra_lsp_t *lsp)
+void kernel_upd_lsp(zebra_lsp_t *lsp)
 {
        int ret;
 
-       if (!lsp || !lsp->best_nhlfe) // unexpected
-               return -1;
+       if (!lsp || !lsp->best_nhlfe) { // unexpected
+               kernel_lsp_pass_fail(lsp, SOUTHBOUND_INSTALL_FAILURE);
+               return;
+       }
 
        ret = kernel_lsp_cmd(RTM_CHANGE, lsp);
 
-       return ret;
+       kernel_lsp_pass_fail(lsp,
+                            (!ret) ?
+                            SOUTHBOUND_INSTALL_SUCCESS :
+                            SOUTHBOUND_INSTALL_FAILURE);
+       return;
 }
 
-int kernel_del_lsp(zebra_lsp_t *lsp)
+void kernel_del_lsp(zebra_lsp_t *lsp)
 {
        int ret;
 
-       if (!lsp) // unexpected
-               return -1;
+       if (!lsp) { // unexpected
+               kernel_lsp_pass_fail(lsp,
+                                    SOUTHBOUND_DELETE_FAILURE);
+               return;
+       }
 
-       if (!CHECK_FLAG(lsp->flags, LSP_FLAG_INSTALLED))
-               return -1;
+       if (!CHECK_FLAG(lsp->flags, LSP_FLAG_INSTALLED)) {
+               kernel_lsp_pass_fail(lsp,
+                                    SOUTHBOUND_DELETE_FAILURE);
+               return;
+       }
 
        ret = kernel_lsp_cmd(RTM_DELETE, lsp);
 
-       return ret;
+       kernel_lsp_pass_fail(lsp,
+                            (!ret) ?
+                            SOUTHBOUND_DELETE_SUCCESS :
+                            SOUTHBOUND_DELETE_FAILURE);
 }
 
 static int kmpw_install(struct zebra_pw *pw)
index dcd4fb02398ac647d7a4357bf78d22fbc1df5a9f..769d2f566619a1dce2690187241aae1691be4ed9 100644 (file)
@@ -817,6 +817,7 @@ int zebra_ptm_bfd_dst_register(struct zserv *client, u_short length,
        zebra_ptm_send_message(ptm_cb.out_data, data_len);
 
 stream_failure:
+       ptm_lib_cleanup_msg(ptm_hdl, out_ctxt);
        return 0;
 }
 
@@ -946,6 +947,7 @@ int zebra_ptm_bfd_dst_deregister(struct zserv *client, u_short length,
        zebra_ptm_send_message(ptm_cb.out_data, data_len);
 
 stream_failure:
+       ptm_lib_cleanup_msg(ptm_hdl, out_ctxt);
        return 0;
 }
 
index 791f319120be91c1a175511340c6e95bf54b631a..58b69659955cf2328e05592c225963376685af0d 100644 (file)
@@ -993,13 +993,49 @@ int zebra_rib_labeled_unicast(struct route_entry *re)
        return 1;
 }
 
+void kernel_route_rib_pass_fail(struct prefix *p, struct route_entry *re,
+                               enum southbound_results res)
+{
+       struct nexthop *nexthop;
+       char buf[PREFIX_STRLEN];
+
+       switch (res) {
+       case SOUTHBOUND_INSTALL_SUCCESS:
+               for (ALL_NEXTHOPS(re->nexthop, nexthop)) {
+                       if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
+                               continue;
+
+                       if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE))
+                               SET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
+                       else
+                               UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
+               }
+               zsend_route_notify_owner(re->type, re->instance, re->vrf_id,
+                                        p, ZAPI_ROUTE_INSTALLED);
+               break;
+       case SOUTHBOUND_INSTALL_FAILURE:
+               zsend_route_notify_owner(re->type, re->instance, re->vrf_id,
+                                        p, ZAPI_ROUTE_FAIL_INSTALL);
+               zlog_warn("%u:%s: Route install failed", re->vrf_id,
+                         prefix2str(p, buf, sizeof(buf)));
+               break;
+       case SOUTHBOUND_DELETE_SUCCESS:
+               for (ALL_NEXTHOPS(re->nexthop, nexthop))
+                       UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
+               break;
+       case SOUTHBOUND_DELETE_FAILURE:
+               zlog_warn("%u:%s: Route Deletion failure", re->vrf_id,
+                         prefix2str(p, buf, sizeof(buf)));
+               break;
+       }
+}
+
 /* Update flag indicates whether this is a "replace" or not. Currently, this
  * is only used for IPv4.
  */
-int rib_install_kernel(struct route_node *rn, struct route_entry *re,
-                      struct route_entry *old)
+void rib_install_kernel(struct route_node *rn, struct route_entry *re,
+                       struct route_entry *old)
 {
-       int ret = 0;
        struct nexthop *nexthop;
        rib_table_info_t *info = srcdest_rnode_table_info(rn);
        struct prefix *p, *src_p;
@@ -1010,7 +1046,7 @@ int rib_install_kernel(struct route_node *rn, struct route_entry *re,
        if (info->safi != SAFI_UNICAST) {
                for (ALL_NEXTHOPS(re->nexthop, nexthop))
                        SET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
-               return ret;
+               return;
        } else {
                struct nexthop *prev;
 
@@ -1042,33 +1078,15 @@ int rib_install_kernel(struct route_node *rn, struct route_entry *re,
         * the kernel.
         */
        hook_call(rib_update, rn, "installing in kernel");
-       ret = kernel_route_rib(p, src_p, old, re);
+       kernel_route_rib(p, src_p, old, re);
        zvrf->installs++;
 
-       /* If install succeeds, update FIB flag for nexthops. */
-       if (!ret) {
-               for (ALL_NEXTHOPS(re->nexthop, nexthop)) {
-                       if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
-                               continue;
-
-                       if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE))
-                               SET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
-                       else
-                               UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
-               }
-               zsend_route_notify_owner(re->type, re->instance, re->vrf_id,
-                                        p, ZAPI_ROUTE_INSTALLED);
-       } else
-               zsend_route_notify_owner(re->type, re->instance, re->vrf_id,
-                                        p, ZAPI_ROUTE_FAIL_INSTALL);
-
-       return ret;
+       return;
 }
 
 /* Uninstall the route from kernel. */
-int rib_uninstall_kernel(struct route_node *rn, struct route_entry *re)
+void rib_uninstall_kernel(struct route_node *rn, struct route_entry *re)
 {
-       int ret = 0;
        struct nexthop *nexthop;
        rib_table_info_t *info = srcdest_rnode_table_info(rn);
        struct prefix *p, *src_p;
@@ -1079,7 +1097,7 @@ int rib_uninstall_kernel(struct route_node *rn, struct route_entry *re)
        if (info->safi != SAFI_UNICAST) {
                for (ALL_NEXTHOPS(re->nexthop, nexthop))
                        UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
-               return ret;
+               return;
        }
 
        /*
@@ -1087,13 +1105,10 @@ int rib_uninstall_kernel(struct route_node *rn, struct route_entry *re)
         * the kernel.
         */
        hook_call(rib_update, rn, "uninstalling from kernel");
-       ret = kernel_route_rib(p, src_p, re, NULL);
+       kernel_route_rib(p, src_p, re, NULL);
        zvrf->removals++;
 
-       for (ALL_NEXTHOPS(re->nexthop, nexthop))
-               UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
-
-       return ret;
+       return;
 }
 
 /* Uninstall the route from kernel. */
@@ -1207,14 +1222,8 @@ static void rib_process_add_fib(struct zebra_vrf *zvrf, struct route_node *rn,
        if (zebra_rib_labeled_unicast(new))
                zebra_mpls_lsp_install(zvrf, rn, new);
 
-       if (!RIB_SYSTEM_ROUTE(new)) {
-               if (rib_install_kernel(rn, new, NULL)) {
-                       char buf[SRCDEST2STR_BUFFER];
-                       srcdest_rnode2str(rn, buf, sizeof(buf));
-                       zlog_warn("%u:%s: Route install failed", zvrf_id(zvrf),
-                                 buf);
-               }
-       }
+       if (!RIB_SYSTEM_ROUTE(new))
+               rib_install_kernel(rn, new, NULL);
 
        UNSET_FLAG(new->status, ROUTE_ENTRY_CHANGED);
 }
@@ -1301,13 +1310,7 @@ static void rib_process_update_fib(struct zebra_vrf *zvrf,
                                if (zebra_rib_labeled_unicast(new))
                                        zebra_mpls_lsp_install(zvrf, rn, new);
 
-                               if (rib_install_kernel(rn, new, old)) {
-                                       char buf[SRCDEST2STR_BUFFER];
-                                       srcdest_rnode2str(rn, buf, sizeof(buf));
-                                       installed = 0;
-                                       zlog_warn("%u:%s: Route install failed",
-                                                 zvrf_id(zvrf), buf);
-                               }
+                               rib_install_kernel(rn, new, old);
                        }
 
                        /* If install succeeded or system route, cleanup flags
@@ -2633,7 +2636,6 @@ static void rib_sweep_table(struct route_table *table)
        struct route_entry *re;
        struct route_entry *next;
        struct nexthop *nexthop;
-       int ret = 0;
 
        if (!table)
                return;
@@ -2670,9 +2672,8 @@ static void rib_sweep_table(struct route_table *table)
                        for (ALL_NEXTHOPS(re->nexthop, nexthop))
                                SET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
 
-                       ret = rib_uninstall_kernel(rn, re);
-                       if (!ret)
-                               rib_delnode(rn, re);
+                       rib_uninstall_kernel(rn, re);
+                       rib_delnode(rn, re);
                }
        }
 }