]> git.proxmox.com Git - mirror_frr.git/commitdiff
Merge pull request #2862 from opensourcerouting/non-recursive
authorDonald Sharp <sharpd@cumulusnetworks.com>
Sun, 9 Sep 2018 17:51:58 +0000 (13:51 -0400)
committerGitHub <noreply@github.com>
Sun, 9 Sep 2018 17:51:58 +0000 (13:51 -0400)
final non-recursive make

14 files changed:
bfdd/bfd_packet.c
ldpd/lde.c
lib/command.c
lib/csv.c
lib/imsg-buffer.c
lib/imsg.c
lib/queue.h
lib/skiplist.c
ospf6d/ospf6_asbr.c
ospf6d/ospf6_route.c
ospfd/ospf_snmp.c
redhat/README.rpm_build.md
staticd/static_vty.c
zebra/zebra_fpm_protobuf.c

index 4bdfb314e2348a9e13e3c181a95304d5d6d4b1b3..8acb9438c564662af5ccc903ce3becb3229ebe5b 100644 (file)
@@ -248,6 +248,8 @@ ssize_t bfd_recv_ipv4(int sd, uint8_t *msgbuf, size_t msgbuflen, uint8_t *ttl,
        struct iovec iov[1];
        uint8_t cmsgbuf[255];
 
+       port[0] = '\0';
+
        /* Prepare the recvmsg params. */
        iov[0].iov_base = msgbuf;
        iov[0].iov_len = msgbuflen;
index 03b62b482b26076fd10c0162d217dec626c2a6f7..81043988863b1c5ab9a6caad4be78b427ff5e8e5 100644 (file)
@@ -1620,10 +1620,8 @@ lde_address_list_free(struct lde_nbr *ln)
 {
        struct lde_addr         *lde_addr;
 
-       while ((lde_addr = TAILQ_FIRST(&ln->addr_list)) != NULL) {
-               TAILQ_REMOVE(&ln->addr_list, lde_addr, entry);
+       while ((lde_addr = TAILQ_POP_FIRST(&ln->addr_list, entry)) != NULL)
                free(lde_addr);
-       }
 }
 
 static void zclient_sync_init(unsigned short instance)
index dd259472b88ac5abbb376694c9dcb2e60b305ed4..26afc762fba20dabc846bd921e41aca305155e62 100644 (file)
@@ -1198,6 +1198,7 @@ static int handle_pipe_action(struct vty *vty, const char *cmd_in,
 
        /* retrieve action */
        token = strsep(&working, " ");
+       assert(token);
 
        /* match result to known actions */
        if (strmatch(token, "include")) {
index ce84783aa6f7570da98027cabbc489a8cf1cd4b6..2752974df57408ad509bd9e1262b90b85dda425f 100644 (file)
--- a/lib/csv.c
+++ b/lib/csv.c
@@ -563,6 +563,8 @@ void csv_decode(csv_t *csv, char *inbuf)
        csv_record_t *rec;
 
        buf = (inbuf) ? inbuf : csv->buf;
+       assert(buf);
+
        pos = strpbrk(buf, "\n");
        while (pos != NULL) {
                rec = calloc(1, sizeof(csv_record_t));
index b83f1f76f2a617dae2d4f9eaf21e383fde2b2c5a..c2f4052b8f5ea66be9be7b5f3cfdcba19cc570a7 100644 (file)
@@ -21,9 +21,9 @@
 #include "queue.h"
 #include "imsg.h"
 
-int ibuf_realloc(struct ibuf *, size_t);
-void ibuf_enqueue(struct msgbuf *, struct ibuf *);
-void ibuf_dequeue(struct msgbuf *, struct ibuf *);
+static int ibuf_realloc(struct ibuf *, size_t);
+static void ibuf_enqueue(struct msgbuf *, struct ibuf *);
+static void ibuf_dequeue(struct msgbuf *, struct ibuf *);
 
 struct ibuf *ibuf_open(size_t len)
 {
@@ -57,7 +57,7 @@ struct ibuf *ibuf_dynamic(size_t len, size_t max)
        return (buf);
 }
 
-int ibuf_realloc(struct ibuf *buf, size_t len)
+static int ibuf_realloc(struct ibuf *buf, size_t len)
 {
        uint8_t *b;
 
@@ -183,6 +183,8 @@ void msgbuf_drain(struct msgbuf *msgbuf, size_t n)
                next = TAILQ_NEXT(buf, entry);
                if (buf->rpos + n >= buf->wpos) {
                        n -= buf->wpos - buf->rpos;
+
+                       TAILQ_REMOVE(&msgbuf->bufs, buf, entry);
                        ibuf_dequeue(msgbuf, buf);
                } else {
                        buf->rpos += n;
@@ -195,7 +197,7 @@ void msgbuf_clear(struct msgbuf *msgbuf)
 {
        struct ibuf *buf;
 
-       while ((buf = TAILQ_FIRST(&msgbuf->bufs)) != NULL)
+       while ((buf = TAILQ_POP_FIRST(&msgbuf->bufs, entry)) != NULL)
                ibuf_dequeue(msgbuf, buf);
 }
 
@@ -266,16 +268,15 @@ again:
        return (1);
 }
 
-void ibuf_enqueue(struct msgbuf *msgbuf, struct ibuf *buf)
+static void ibuf_enqueue(struct msgbuf *msgbuf, struct ibuf *buf)
 {
        TAILQ_INSERT_TAIL(&msgbuf->bufs, buf, entry);
        msgbuf->queued++;
 }
 
-void ibuf_dequeue(struct msgbuf *msgbuf, struct ibuf *buf)
+static void ibuf_dequeue(struct msgbuf *msgbuf, struct ibuf *buf)
 {
-       TAILQ_REMOVE(&msgbuf->bufs, buf, entry);
-
+       /* TAILQ_REMOVE done by caller */
        if (buf->fd != -1)
                close(buf->fd);
 
index 54241407205d203f0ae3964e784afbf27bc03e7d..935d13772752a2a668fc4d9699793c4addd7845a 100644 (file)
@@ -299,11 +299,10 @@ int imsg_get_fd(struct imsgbuf *ibuf)
        int fd;
        struct imsg_fd *ifd;
 
-       if ((ifd = TAILQ_FIRST(&ibuf->fds)) == NULL)
+       if ((ifd = TAILQ_POP_FIRST(&ibuf->fds, entry)) == NULL)
                return (-1);
 
        fd = ifd->fd;
-       TAILQ_REMOVE(&ibuf->fds, ifd, entry);
        free(ifd);
 
        return (fd);
index 04fbeee7004c98ab159eb714a9968dfd8eda94f1..11e28b4c912554caf2c9cae8adebb407a46ce0fb 100644 (file)
 #include "freebsd-queue.h"
 #endif /* defined(__OpenBSD__) && !defined(STAILQ_HEAD) */
 
+#ifndef TAILQ_POP_FIRST
+#define TAILQ_POP_FIRST(head, field)                                           \
+       ({  typeof((head)->tqh_first) _elm = TAILQ_FIRST(head);                \
+           if (_elm) {                                                        \
+               if ((TAILQ_NEXT((_elm), field)) != NULL)                       \
+                       TAILQ_NEXT((_elm), field)->field.tqe_prev =            \
+                               &TAILQ_FIRST(head);                            \
+               else                                                           \
+                       (head)->tqh_last = &TAILQ_FIRST(head);                 \
+               TAILQ_FIRST(head) = TAILQ_NEXT((_elm), field);                 \
+       }; _elm; })
+#endif
+
 #endif /* _FRR_QUEUE_H */
index a36bf47139c307ceacc85629427a747dec394939..585cf859e5742b1a952a0ba935e6c9f1c6b19d56 100644 (file)
@@ -202,6 +202,7 @@ int skiplist_insert(register struct skiplist *l, register void *key,
        }
 
        k = randomLevel();
+       assert(k >= 0);
        if (k > l->level) {
                k = ++l->level;
                update[k] = l->header;
index 5af88defeba69dc6a65251900ff33c61567a5db1..dc7a3f6d45766c8f8b848b45273fbdcab741a6da 100644 (file)
@@ -732,7 +732,8 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa,
                                                        ? 1
                                                        : 2,
                                                buf, listcount(route->paths),
-                                               listcount(route->nh_list));
+                                               route->nh_list ?
+                                               listcount(route->nh_list) : 0);
                                }
 
                                if (listcount(route->paths)) {
index a099eead49bab5bf718a24ec3901b28f5f6a9bdc..021e825ae33dc82a27de356081d523d06f2b3cee 100644 (file)
@@ -732,7 +732,7 @@ struct ospf6_route *ospf6_route_add(struct ospf6_route *route,
                route->next = next;
 
                if (node->info == next) {
-                       assert(next->rnode == node);
+                       assert(next && next->rnode == node);
                        node->info = route;
                        UNSET_FLAG(next->flag, OSPF6_ROUTE_BEST);
                        SET_FLAG(route->flag, OSPF6_ROUTE_BEST);
index 19d2e6a95251f4fb1de862a5c56bda0105842370..755634a2f166c5d2d9935351a016a71a7b1b3cc1 100644 (file)
@@ -995,7 +995,6 @@ static struct ospf_lsa *ospfLsdbLookup(struct variable *v, oid *name,
                        if (len <= 0)
                                type_next = 1;
                        else {
-                               len = 1;
                                type_next = 0;
                                *type = *offset;
                        }
index c461e543d238b4cd23d78ae8bbe1b7b58e63b88e..93a731d685e91d8f82437869f22a6a2f03b838c4 100644 (file)
@@ -3,16 +3,15 @@ Building your own FRRouting RPM
 (Tested on CentOS 6, CentOS 7 and Fedora 24.)
 
 1. On CentOS 6 (which doesn't provide a bison/automake/autoconf of a recent enough version):
-    - Check out ../doc/Building_FRR_on_CentOS6.md for details on installing
+    - Check out ../doc/developer/building-frr-for-centos6.rst for details on installing
     a bison/automake/autoconf to support frr building.
 
     Newer automake/autoconf/bison is only needed to build the rpm and is
     **not** needed to install the binary rpm package
 
-2. Install the build packages as documented in doc/Building_on_xxxxx.md 
-   and the following additional packages:
+2. Install the build packages as documented in doc/developer/building-frr-for-xxxxx.rst and the following additional packages:
 
-        yum install rpm-build net-snmp-devel pam-devel
+        yum install rpm-build net-snmp-devel pam-devel libcap-devel
 
     Additionally, on systems with systemd (CentOS 7, Fedora)
 
index b323612d7e377294be6259d01d95416e2088e416..f697969a7227d34faae573098b5a67d706124d84 100644 (file)
@@ -88,8 +88,8 @@ static struct list *static_list;
 
 static int static_list_compare_helper(const char *s1, const char *s2)
 {
-       /* Are Both NULL */
-       if (s1 == s2)
+       /* extra (!s1 && !s2) to keep SA happy */
+       if (s1 == s2 || (!s1 && !s2))
                return 0;
 
        if (!s1 && s2)
index ebd632270c7d004b855799e55fcd3c2776a3dcd7..be0f6a23be74224f4a83756306b5b30e784d4323 100644 (file)
@@ -129,6 +129,7 @@ static inline int add_nexthop(qpb_allocator_t *allocator, Fpm__AddRoute *msg,
        }
 
        // TODO: Use src.
+       (void)src;
 
        return 1;
 }