patch pax-utils pcre perl pkgconf python2 python2-dev readline
readline-dev sqlite-libs squashfs-tools sudo tar texinfo xorriso xz-libs
py-sphinx"
+checkdepends="pytest py-setuptools"
install="$pkgname.pre-install $pkgname.pre-deinstall $pkgname.post-deinstall"
subpackages="$pkgname-dev $pkgname-doc $pkgname-dbg"
source="$pkgname-$pkgver.tar.gz docker-start daemons daemons.conf"
--enable-multipath=64 \
--enable-vty-group=frrvty \
--enable-user=$_user \
- --enable-group=$_user || return 1
- make || return 1
+ --enable-group=$_user
+ make
+}
+
+check() {
+ cd "$builddir"
+
+ make -j 1 check
}
package() {
cd "$builddir"
- make DESTDIR="$pkgdir" install || return 1
+ make DESTDIR="$pkgdir" install
install -Dm755 "$srcdir"/docker-start "$pkgdir"$_sbindir
install -Dm644 "$srcdir"/daemons "$pkgdir"$_sysconfdir
break;
if(k > 0)
channels[j++] = ',';
- snprintf(channels + j, 100 - j, "%d", route->channels[k]);
+ snprintf(channels + j, 100 - j, "%u", route->channels[k]);
j = strlen(channels);
}
snprintf(channels + j, 100 - j, ")");
check_bucket(struct interface *ifp)
{
babel_interface_nfo *babel_ifp = babel_get_if_nfo(ifp);
- if(babel_ifp->bucket <= 0) {
+ if(babel_ifp->bucket == 0) {
int seconds = babel_now.tv_sec - babel_ifp->bucket_time;
if(seconds > 0) {
babel_ifp->bucket = MIN(BUCKET_TOKENS_MAX,
int rc = 0;
if(hello < 0) {
- if(neigh->hello_interval <= 0)
+ if(neigh->hello_interval == 0)
return rc;
missed_hellos =
((int)timeval_minus_msec(&babel_now, &neigh->hello_time) -
static char buf[4][15];
static int i = 0;
i = (i + 1) % 4;
- snprintf(buf[i], 15, "%d.%.3d", value / 1000, value % 1000);
+ snprintf(buf[i], 15, "%u.%.3u", value / 1000, value % 1000);
return buf[i];
}
zlog_debug(
"%s: starting mpath update, newbest %s num candidates %d old-mpath-count %d",
pfx_buf, new_best ? new_best->peer->host : "NONE",
- listcount(mp_list), old_mpath_count);
+ mp_list ? listcount(mp_list) : 0, old_mpath_count);
/*
* We perform an ordered walk through both lists in parallel.
THREAD_TIMER_OFF(subgrp->t_coalesce);
sync_delete(subgrp);
- if (BGP_DEBUG(update_groups, UPDATE_GROUPS))
+ if (BGP_DEBUG(update_groups, UPDATE_GROUPS) && subgrp->update_group)
zlog_debug("delete subgroup u%" PRIu64 ":s%" PRIu64,
subgrp->update_group->id, subgrp->id);
vnc_import_bgp_exterior_redist_enable((bgp), (afi)); \
break; \
default: \
- vnc_redistribute_set((bgp), (afi), (type)); \
+ if ((type) < ZEBRA_ROUTE_MAX) \
+ vnc_redistribute_set((bgp), (afi), (type)); \
break; \
} \
} while (0)
vnc_import_bgp_exterior_redist_disable((bgp), (afi)); \
break; \
default: \
- vnc_redistribute_unset((bgp), (afi), (type)); \
+ if ((type) < ZEBRA_ROUTE_MAX) \
+ vnc_redistribute_unset((bgp), (afi), (type)); \
break; \
} \
} while (0)
{
struct rfapi_ip_addr vn;
struct rfapi_ip_addr un;
- struct rfapi_ip_addr target;
- rfapi_handle handle;
int rc;
- struct rfapi_next_hop_entry *pNextHopEntry;
- struct rfapi_l2address_option l2o_buf;
- struct bgp_tea_options hopt;
- uint8_t valbuf[14];
/*
* Get VN addr
if ((rc = rfapiCliGetRfapiIpAddr(vty, argv[6]->arg, &un)))
return rc;
-
-#if 0 /* there is no IP target arg here ?????? */
- /*
- * Get target addr
- */
- if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[2], &target)))
- return rc;
-#else
vty_out(vty, "%% This command is broken.\n");
return CMD_WARNING_CONFIG_FAILED;
-#endif
-
- if (rfapi_find_handle_vty(vty, &vn, &un, &handle)) {
- vty_out(vty, "can't locate handle matching vn=%s, un=%s\n",
- argv[4]->arg, argv[6]->arg);
- return CMD_WARNING_CONFIG_FAILED;
- }
-
- /*
- * Set up L2 parameters
- */
- memset(&l2o_buf, 0, sizeof(l2o_buf));
- if (rfapiStr2EthAddr(argv[10]->arg, &l2o_buf.macaddr)) {
- vty_out(vty, "Bad mac address \"%s\"\n", argv[10]->arg);
- return CMD_WARNING_CONFIG_FAILED;
- }
-
- l2o_buf.logical_net_id = strtoul(argv[8]->arg, NULL, 10);
-
- /* construct option chain */
-
- memset(valbuf, 0, sizeof(valbuf));
- memcpy(valbuf, &l2o_buf.macaddr.octet, ETH_ALEN);
- valbuf[11] = (l2o_buf.logical_net_id >> 16) & 0xff;
- valbuf[12] = (l2o_buf.logical_net_id >> 8) & 0xff;
- valbuf[13] = l2o_buf.logical_net_id & 0xff;
-
- memset(&hopt, 0, sizeof(hopt));
- hopt.options_count = 1;
- hopt.options_length = sizeof(valbuf); /* is this right? */
- hopt.type = RFAPI_VN_OPTION_TYPE_L2ADDR;
- hopt.length = sizeof(valbuf);
- hopt.value = valbuf;
-
-
- /*
- * options parameter not used? Set to NULL for now
- */
- rc = rfapi_query(handle, &target, &l2o_buf, &pNextHopEntry);
-
- if (rc) {
- vty_out(vty, "rfapi_query failed with rc=%d (%s)\n", rc,
- strerror(rc));
- } else {
- /*
- * print nexthop list
- */
- /* TBD enhance to print L2 information */
- test_nexthops_callback(/*&target, */ pNextHopEntry,
- vty); /* frees nh list! */
- }
-
- return CMD_SUCCESS;
}
int eigrp_sock_init(void)
{
int eigrp_sock;
- int ret, hincl = 1;
+ int ret;
+#ifdef IP_HDRINCL
+ int hincl = 1;
+#endif
if (eigrpd_privs.change(ZPRIVS_RAISE))
zlog_err("eigrp_sock_init: could not raise privs, %s",
struct listnode *node, *nnode, *node2, *nnode2;
struct eigrp_interface *ei;
struct eigrp_neighbor *nbr;
- struct route_node *rn;
struct eigrp_neighbor *min = NULL;
struct eigrp *eigrp;
first = 0;
len = *length - v->namelen;
- if (len <= 0)
+ if (len == 0)
first = 1;
if (len > IN_ADDR_SIZE)
WriteMethod **write_method)
{
struct eigrp *eigrp;
- struct eigrp_interface *ei;
- struct listnode *node, *nnode;
eigrp = eigrp_lookup();
{
struct eigrp *eigrp;
struct eigrp_interface *ei;
- struct listnode *node, *nnode;
struct eigrp_neighbor *nbr;
struct in_addr nbr_addr;
unsigned int ifindex;
WriteMethod **write_method)
{
struct eigrp *eigrp;
- struct eigrp_interface *ei;
struct listnode *node, *nnode;
struct keychain *keychain;
struct list *keylist;
- int counter;
eigrp = eigrp_lookup();
for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_link, node,
ip6)) {
prefix2str((struct prefix *)ip6, (char *)buf,
- BUFSIZ);
+ sizeof(buf));
zlog_warn(" %s", buf);
}
zlog_warn(" -----");
for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_non_link, node,
ip6)) {
prefix2str((struct prefix *)ip6, (char *)buf,
- BUFSIZ);
+ sizeof(buf));
zlog_warn(" %s", buf);
}
zlog_warn("End of addresses");
/* reschedule read */
*threadp = NULL;
- thread_add_read(master, disc_recv_packet, threadp, fd, &*threadp);
+ thread_add_read(master, disc_recv_packet, threadp, fd, threadp);
/* setup buffer */
memset(&m, 0, sizeof(m));
log_verbose("Mem: %d\n", get_memory_usage(getpid()));
csv_init(&csv, buf, 256);
- sprintf(hdr1, "%4u", 0);
- sprintf(hdr2, "%4u", 1);
+ sprintf(hdr1, "%4d", 0);
+ sprintf(hdr2, "%4d", 1);
log_verbose("(%zu/%zu/%d/%d)\n", strlen(hdr1), strlen(hdr2), atoi(hdr1),
atoi(hdr2));
rec = csv_encode(&csv, 2, hdr1, hdr2);
}
csv_encode(&csv, 2, "pdfadfadfadsadsaddfdfdsfdsd", "35444554545454545");
log_verbose("%s\n", buf);
- sprintf(hdr1, "%4u", csv.csv_len);
- sprintf(hdr2, "%4u", 1);
+ sprintf(hdr1, "%4d", csv.csv_len);
+ sprintf(hdr2, "%4d", 1);
log_verbose("(%zu/%zu/%d/%d)\n", strlen(hdr1), strlen(hdr2), atoi(hdr1),
atoi(hdr2));
rec = csv_encode_record(&csv, rec, 2, hdr1, hdr2);
char client_buf[32];
csv_record_t *rec1;
- sprintf(msglen_buf, "%4u", msglen);
- sprintf(vers_buf, "%4u", version);
- sprintf(type_buf, "%4u", type);
- sprintf(cmdid_buf, "%4u", cmd_id);
+ sprintf(msglen_buf, "%4d", msglen);
+ sprintf(vers_buf, "%4d", version);
+ sprintf(type_buf, "%4d", type);
+ sprintf(cmdid_buf, "%4d", cmd_id);
snprintf(client_buf, 17, "%16.16s", client_name);
if (rec) {
rec1 = csv_encode_record(csv, rec, 5, msglen_buf, vers_buf,
int quagga_signal_timer(struct thread *t)
{
struct quagga_sigevent_master_t *sigm;
- struct quagga_signal_t *sig;
- int i;
sigm = THREAD_ARG(t);
sigm->t = NULL;
return;
}
- for (i = 0; he->h_addr_list[i] != NULL && i < ZEBRA_NUM_OF(addr); i++) {
+ for (i = 0; i < ZEBRA_NUM_OF(addr) && he->h_addr_list[i] != NULL; i++) {
memset(&addr[i], 0, sizeof(addr[i]));
addr[i].sa.sa_family = he->h_addrtype;
switch (he->h_addrtype) {
else
state = ISM_DROther;
- memset(buf, 0, size);
-
snprintf(buf, size, "%s/%s",
lookup_msg(ospf_nsm_state_msg, nbr->state, NULL),
lookup_msg(ospf_ism_state_msg, state, NULL));
}
if (w > 99)
- snprintf(buf, size, "%ldw%1ldd", w, d);
+ snprintf(buf, size, "%luw%1lud", w, d);
else if (w)
- snprintf(buf, size, "%ldw%1ldd%02ldh", w, d, h);
+ snprintf(buf, size, "%luw%1lud%02luh", w, d, h);
else if (d)
- snprintf(buf, size, "%1ldd%02ldh%02ldm", d, h, m);
+ snprintf(buf, size, "%1lud%02luh%02lum", d, h, m);
else if (h)
- snprintf(buf, size, "%ldh%02ldm%02lds", h, m, (long)t->tv_sec);
+ snprintf(buf, size, "%luh%02lum%02lds", h, m, (long)t->tv_sec);
else if (m)
- snprintf(buf, size, "%ldm%02lds", m, (long)t->tv_sec);
+ snprintf(buf, size, "%lum%02lds", m, (long)t->tv_sec);
else if (ms)
- snprintf(buf, size, "%ld.%03lds", (long)t->tv_sec, ms);
+ snprintf(buf, size, "%ld.%03lus", (long)t->tv_sec, ms);
else
snprintf(buf, size, "%ld usecs", (long)t->tv_usec);
static char *ospf_dd_flags_dump(uint8_t flags, char *buf, size_t size)
{
- memset(buf, 0, size);
-
snprintf(buf, size, "%s|%s|%s", (flags & OSPF_DD_FLAG_I) ? "I" : "-",
(flags & OSPF_DD_FLAG_M) ? "M" : "-",
(flags & OSPF_DD_FLAG_MS) ? "MS" : "-");
static char *ospf_router_lsa_flags_dump(uint8_t flags, char *buf, size_t size)
{
- memset(buf, 0, size);
-
snprintf(buf, size, "%s|%s|%s",
(flags & ROUTER_LSA_VIRTUAL) ? "V" : "-",
(flags & ROUTER_LSA_EXTERNAL) ? "E" : "-",
return CMD_SUCCESS;
if (ospf->instance)
- sprintf(str, " %d", ospf->instance);
+ sprintf(str, " %u", ospf->instance);
/* debug ospf ism (status|events|timers). */
if (IS_CONF_DEBUG_OSPF(ism, ISM) == OSPF_DEBUG_ISM)
"ospf_vl_new(): creating pseudo zebra interface vrf id %u",
ospf->vrf_id);
- snprintf(ifname, sizeof(ifname), "VLINK%d", vlink_count);
+ snprintf(ifname, sizeof(ifname), "VLINK%u", vlink_count);
vi = if_create(ifname, ospf->vrf_id);
/*
* if_create sets ZEBRA_INTERFACE_LINKDETECTION
len = *length - v->namelen;
if (len >= IN_ADDR_SIZE)
len = IN_ADDR_SIZE;
- if (len <= 0)
+ if (len == 0)
ifaddr_next = 1;
oid2in_addr(name + v->namelen, len, ifaddr);
first = 0;
len = *length - v->namelen;
- if (len <= 0)
+ if (len == 0)
first = 1;
if (len > IN_ADDR_SIZE)
len = IN_ADDR_SIZE;
first = 0;
len = *length - v->namelen;
- if (len <= 0)
+ if (len == 0)
first = 1;
if (len > IN_ADDR_SIZE)
mtrace_len = ntohs(ip->ip_len) - ip->ip_hl * 4;
+ if ((char *)mtrace + mtrace_len
+ > (char *)mtrace_buf + IP_AND_MTRACE_BUF_LEN)
+ return -1;
+
if (mtrace_len < (int)MTRACE_HDR_SIZE)
return -1;
struct prefix_sg sg;
int i;
- memset(buf, 0, size);
sg.src = c_oil->oil.mfcc_origin;
sg.grp = c_oil->oil.mfcc_mcastgrp;
sprintf(buf, "%s IIF: %d, OIFS: ", pim_str_sg_dump(&sg),
printf("verify: lib failed\n");
if (ospfd != lib) {
- printf("Mismatch in values at size %u\n"
+ printf("Mismatch in values at size %d\n"
"ospfd: 0x%04x\tc0: %d\tc1: %d\tx: %d\ty: %d\n"
"isisd: 0x%04x\tc0: %d\tc1: %d\tx: %d\ty: %d\n"
"lib: 0x%04x\n",
/* create vertices */
for (unsigned int i = 0; i < NUMNODES; i++) {
- snprintf(names[i], sizeof(names[i]), "%d", i);
+ snprintf(names[i], sizeof(names[i]), "%u", i);
gn[i] = graph_new_node(g, names[i], NULL);
}
t_remove = 1000 * (tv_stop.tv_sec - tv_lap.tv_sec);
t_remove += (tv_stop.tv_usec - tv_lap.tv_usec) / 1000;
- printf("Scheduling %d random timers took %ld.%03ld seconds.\n",
+ printf("Scheduling %d random timers took %lu.%03lu seconds.\n",
SCHEDULE_TIMERS, t_schedule / 1000, t_schedule % 1000);
- printf("Removing %d random timers took %ld.%03ld seconds.\n",
+ printf("Removing %d random timers took %lu.%03lu seconds.\n",
REMOVE_TIMERS, t_remove / 1000, t_remove % 1000);
fflush(stdout);
char line[] = "do write terminal\n";
FILE *fp;
int fd;
+#ifdef FRR_USER
struct passwd *pwentry;
+#endif
+#ifdef FRR_GROUP
struct group *grentry;
+#endif
uid_t uid = -1;
gid_t gid = -1;
struct stat st;
}
if (dryrun && cmd && cmd->line) {
- vtysh_execute("enable");
+ if (!user_mode)
+ vtysh_execute("enable");
while (cmd) {
struct cmd_rec *cr;
char *cmdnow = cmd->line, *next;
suid_off();
if (writeconfig) {
+ if (user_mode) {
+ fprintf(stderr,
+ "writeconfig cannot be used when running as an unprivileged user.\n");
+ if (no_error)
+ exit(0);
+ else
+ exit(1);
+ }
vtysh_execute("enable");
return vtysh_write_config_integrated();
}
/* If eval mode. */
if (cmd && cmd->line) {
/* Enter into enable node. */
- vtysh_execute("enable");
+ if (!user_mode)
+ vtysh_execute("enable");
while (cmd != NULL) {
int ret;
vty_hello(vty);
/* Enter into enable node. */
- vtysh_execute("enable");
+ if (!user_mode)
+ vtysh_execute("enable");
/* Preparation for longjmp() in sigtstp(). */
sigsetjmp(jmpbuf, 1);