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;
{
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)
/* retrieve action */
token = strsep(&working, " ");
+ assert(token);
/* match result to known actions */
if (strmatch(token, "include")) {
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));
#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)
{
return (buf);
}
-int ibuf_realloc(struct ibuf *buf, size_t len)
+static int ibuf_realloc(struct ibuf *buf, size_t len)
{
uint8_t *b;
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;
{
struct ibuf *buf;
- while ((buf = TAILQ_FIRST(&msgbuf->bufs)) != NULL)
+ while ((buf = TAILQ_POP_FIRST(&msgbuf->bufs, entry)) != NULL)
ibuf_dequeue(msgbuf, buf);
}
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);
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);
#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 */
}
k = randomLevel();
+ assert(k >= 0);
if (k > l->level) {
k = ++l->level;
update[k] = l->header;
? 1
: 2,
buf, listcount(route->paths),
- listcount(route->nh_list));
+ route->nh_list ?
+ listcount(route->nh_list) : 0);
}
if (listcount(route->paths)) {
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);
if (len <= 0)
type_next = 1;
else {
- len = 1;
type_next = 0;
*type = *offset;
}
(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)
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)
}
// TODO: Use src.
+ (void)src;
return 1;
}