frr_run(bm->master);
/* Not reached. */
- return (0);
+ return 0;
}
if (peer->status == Established || peer->status == Clearing) {
bgp_notify_send(new, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_COLLISION_RESOLUTION);
- return (-1);
+ return -1;
} else if ((peer->status == OpenConfirm)
|| (peer->status == OpenSent)) {
/* 1. The BGP Identifier of the local system is compared
route_map_walk_update_list(bgp_route_map_process_update_cb);
- return (0);
+ return 0;
}
static void bgp_route_map_mark_update(const char *rmap_name)
THREAD_TIMER_OFF(bgp->t_rmap_def_originate_eval);
bgp_unlock(bgp);
- return (0);
+ return 0;
}
/*
frr_run(master);
/* Not reached. */
- return (0);
+ return 0;
}
csv = malloc(sizeof(csv_t));
if (csv == NULL) {
log_error("CSV Malloc failed\n");
- return (NULL);
+ return NULL;
}
}
memset(csv, 0, sizeof(csv_t));
{
*fld = TAILQ_NEXT(*fld, next_field);
if ((*fld) == NULL) {
- return (NULL);
+ return NULL;
}
return ((*fld)->field);
}
if (!fld) {
log_error("field malloc failed\n");
/* more cleanup needed */
- return (NULL);
+ return NULL;
}
TAILQ_INSERT_TAIL(&(rec->fields), fld, next_field);
fld->field = str + rlen;
str = (char *)malloc(csv->buflen);
if (!str) {
log_error("field str malloc failed\n");
- return (NULL);
+ return NULL;
}
}
if (!buf)
free(str);
va_end(list);
- return (NULL);
+ return NULL;
}
csv_init_record(rec);
rec->record = str;
log_error("fld malloc failed\n");
csv_remove_record(csv, rec);
va_end(list);
- return (NULL);
+ return NULL;
}
if (tempc < (count - 1)) {
rec->rec_len += snprintf((str + rec->rec_len),
if (!csv_is_record_valid(csv, rec1)
|| !csv_is_record_valid(csv, rec2)) {
log_error("rec1 and/or rec2 invalid\n");
- return (NULL);
+ return NULL;
}
/* we can only concat records if no buf was supplied during csv init */
if (csv->buf) {
log_error(
"un-supported for this csv type - single buf detected\n");
- return (NULL);
+ return NULL;
}
/* create a new rec */
rec = calloc(1, sizeof(csv_record_t));
if (!rec) {
log_error("record malloc failed\n");
- return (NULL);
+ return NULL;
}
csv_init_record(rec);
struct ibuf *buf;
if ((buf = calloc(1, sizeof(struct ibuf))) == NULL)
- return (NULL);
+ return NULL;
if ((buf->buf = malloc(len)) == NULL) {
free(buf);
- return (NULL);
+ return NULL;
}
buf->size = buf->max = len;
buf->fd = -1;
struct ibuf *buf;
if (max < len)
- return (NULL);
+ return NULL;
if ((buf = ibuf_open(len)) == NULL)
- return (NULL);
+ return NULL;
if (max > 0)
buf->max = max;
/* on static buffers max is eq size and so the following fails */
if (buf->wpos + len > buf->max) {
errno = ERANGE;
- return (-1);
+ return -1;
}
b = realloc(buf->buf, buf->wpos + len);
if (b == NULL)
- return (-1);
+ return -1;
buf->buf = b;
buf->size = buf->wpos + len;
- return (0);
+ return 0;
}
int ibuf_add(struct ibuf *buf, const void *data, size_t len)
{
if (buf->wpos + len > buf->size)
if (ibuf_realloc(buf, len) == -1)
- return (-1);
+ return -1;
memcpy(buf->buf + buf->wpos, data, len);
buf->wpos += len;
- return (0);
+ return 0;
}
void *ibuf_reserve(struct ibuf *buf, size_t len)
if (buf->wpos + len > buf->size)
if (ibuf_realloc(buf, len) == -1)
- return (NULL);
+ return NULL;
b = buf->buf + buf->wpos;
buf->wpos += len;
{
/* only allowed to seek in already written parts */
if (pos + len > buf->wpos)
- return (NULL);
+ return NULL;
return (buf->buf + pos);
}
goto again;
if (errno == ENOBUFS)
errno = EAGAIN;
- return (-1);
+ return -1;
}
if (n == 0) { /* connection closed */
errno = 0;
- return (0);
+ return 0;
}
msgbuf_drain(msgbuf, n);
- return (1);
+ return 1;
}
void ibuf_free(struct ibuf *buf)
goto again;
if (errno == ENOBUFS)
errno = EAGAIN;
- return (-1);
+ return -1;
}
if (n == 0) { /* connection closed */
errno = 0;
- return (0);
+ return 0;
}
/*
msgbuf_drain(msgbuf, n);
- return (1);
+ return 1;
}
static void ibuf_enqueue(struct msgbuf *msgbuf, struct ibuf *buf)
int ret, fds[256];
if (n > (unsigned int)array_size(fds))
- return (1);
+ return 1;
ret = 0;
for (i = 0; i < n; i++) {
msg.msg_controllen = sizeof(cmsgbuf.buf);
if ((ifd = calloc(1, sizeof(struct imsg_fd))) == NULL)
- return (-1);
+ return -1;
again:
#ifdef __OpenBSD__
#endif
errno = EAGAIN;
free(ifd);
- return (-1);
+ return -1;
}
n = recvmsg(ibuf->fd, &msg, 0);
av = ibuf->r.wpos;
if (IMSG_HEADER_SIZE > av)
- return (0);
+ return 0;
memcpy(&imsg->hdr, ibuf->r.buf, sizeof(imsg->hdr));
if (imsg->hdr.len < IMSG_HEADER_SIZE || imsg->hdr.len > MAX_IMSGSIZE) {
errno = ERANGE;
- return (-1);
+ return -1;
}
if (imsg->hdr.len > av)
- return (0);
+ return 0;
datalen = imsg->hdr.len - IMSG_HEADER_SIZE;
ibuf->r.rptr = ibuf->r.buf + IMSG_HEADER_SIZE;
if (datalen == 0)
imsg->data = NULL;
else if ((imsg->data = malloc(datalen)) == NULL)
- return (-1);
+ return -1;
if (imsg->hdr.flags & IMSGF_HASFD)
imsg->fd = imsg_get_fd(ibuf);
struct ibuf *wbuf;
if ((wbuf = imsg_create(ibuf, type, peerid, pid, datalen)) == NULL)
- return (-1);
+ return -1;
if (imsg_add(wbuf, data, datalen) == -1)
- return (-1);
+ return -1;
wbuf->fd = fd;
imsg_close(ibuf, wbuf);
- return (1);
+ return 1;
}
int imsg_composev(struct imsgbuf *ibuf, uint32_t type, uint32_t peerid,
datalen += iov[i].iov_len;
if ((wbuf = imsg_create(ibuf, type, peerid, pid, datalen)) == NULL)
- return (-1);
+ return -1;
for (i = 0; i < iovcnt; i++)
if (imsg_add(wbuf, iov[i].iov_base, iov[i].iov_len) == -1)
- return (-1);
+ return -1;
wbuf->fd = fd;
imsg_close(ibuf, wbuf);
- return (1);
+ return 1;
}
/* ARGSUSED */
datalen += IMSG_HEADER_SIZE;
if (datalen > MAX_IMSGSIZE) {
errno = ERANGE;
- return (NULL);
+ return NULL;
}
hdr.type = type;
if ((hdr.pid = pid) == 0)
hdr.pid = ibuf->pid;
if ((wbuf = ibuf_dynamic(datalen, MAX_IMSGSIZE)) == NULL) {
- return (NULL);
+ return NULL;
}
if (imsg_add(wbuf, &hdr, sizeof(hdr)) == -1)
- return (NULL);
+ return NULL;
return (wbuf);
}
if (datalen)
if (ibuf_add(msg, data, datalen) == -1) {
ibuf_free(msg);
- return (-1);
+ return -1;
}
return (datalen);
}
struct imsg_fd *ifd;
if ((ifd = TAILQ_POP_FIRST(&ibuf->fds, entry)) == NULL)
- return (-1);
+ return -1;
fd = ifd->fd;
free(ifd);
{
while (ibuf->w.queued)
if (msgbuf_write(&ibuf->w) <= 0)
- return (-1);
- return (0);
+ return -1;
+ return 0;
}
void imsg_clear(struct imsgbuf *ibuf)
rbe_insert_color(t, rbt, rbe);
- return (NULL);
+ return NULL;
}
/* Finds the node with the same key as elm */
return (node);
}
- return (NULL);
+ return NULL;
}
/* Finds the first node greater than or equal to the search key */
if (types->nextarg >= types->tablesize) {
if (__grow_type_table(types))
- return (-1);
+ return -1;
}
if (types->nextarg > types->tablemax)
types->tablemax = types->nextarg;
- return (0);
+ return 0;
}
/*
{
if (_ensurespace(types))
- return (-1);
+ return -1;
types->table[types->nextarg++] = type;
- return (0);
+ return 0;
}
static inline int
{
if (_ensurespace(types))
- return (-1);
+ return -1;
if (flags & LONGDBL)
types->table[types->nextarg++] = T_INT64T;
else if (flags & INTMAXT)
types->table[types->nextarg++] = T_LONG;
else
types->table[types->nextarg++] = T_INT;
- return (0);
+ return 0;
}
static inline int
{
if (_ensurespace(types))
- return (-1);
+ return -1;
if (flags & LONGDBL)
types->table[types->nextarg++] = T_UINT64T;
else if (flags & INTMAXT)
types->table[types->nextarg++] = T_U_LONG;
else
types->table[types->nextarg++] = T_U_INT;
- return (0);
+ return 0;
}
/*
u_int hold = types->nextarg;
types->nextarg = n2;
if (addtype(types, T_INT))
- return (-1);
+ return -1;
types->nextarg = hold;
*fmtp = ++cp;
} else {
if (addtype(types, T_INT))
- return (-1);
+ return -1;
}
- return (0);
+ return 0;
}
#ifdef WCHAR_SUPPORT
u_int hold = types->nextarg;
types->nextarg = n2;
if (addtype(types, T_INT))
- return (-1);
+ return -1;
types->nextarg = hold;
*fmtp = ++cp;
} else {
if (addtype(types, T_INT))
- return (-1);
+ return -1;
}
- return (0);
+ return 0;
}
#endif /* WCHAR_SUPPORT */
/* Detect overflow */
if (types->nextarg > MAX_POSARG)
- return (-1);
+ return -1;
newsize = oldsize * 2;
if (newsize < types->nextarg + 1)
newsize = types->nextarg + 1;
if (oldsize == STATIC_ARG_TBL_SIZE) {
if ((newtable = malloc(newsize * sizeof(enum typeid))) == NULL)
- return (-1);
+ return -1;
bcopy(oldtable, newtable, oldsize * sizeof(enum typeid));
} else {
newtable = realloc(oldtable, newsize * sizeof(enum typeid));
if (newtable == NULL)
- return (-1);
+ return -1;
}
for (n = oldsize; n < newsize; n++)
newtable[n] = T_UNUSED;
types->table = newtable;
types->tablesize = newsize;
- return (0);
+ return 0;
}
/*
mbs = initial;
nbytes = wcsrtombs(NULL, (const wchar_t **)&p, 0, &mbs);
if (nbytes == (size_t)-1)
- return (NULL);
+ return NULL;
} else {
/*
* Optimisation: if the output precision is small enough,
}
}
if ((convbuf = malloc(nbytes + 1)) == NULL)
- return (NULL);
+ return NULL;
/* Fill the output buffer. */
p = wcsarg;
if ((nbytes = wcsrtombs(convbuf, (const wchar_t **)&p,
nbytes, &mbs)) == (size_t)-1) {
free(convbuf);
- return (NULL);
+ return NULL;
}
convbuf[nbytes] = '\0';
return (convbuf);
rec = csv_record_iter(csv);
if (rec == NULL) {
DLOG("malformed CSV\n");
- return (-1);
+ return -1;
}
hdr = csv_field_iter(rec, &fld);
if (hdr == NULL) {
DLOG("malformed CSV\n");
- return (-1);
+ return -1;
}
*msglen = atoi(hdr);
hdr = csv_field_iter_next(&fld);
if (hdr == NULL) {
DLOG("malformed CSV\n");
- return (-1);
+ return -1;
}
*version = atoi(hdr);
hdr = csv_field_iter_next(&fld);
if (hdr == NULL) {
DLOG("malformed CSV\n");
- return (-1);
+ return -1;
}
*type = atoi(hdr);
hdr = csv_field_iter_next(&fld);
if (hdr == NULL) {
DLOG("malformed CSV\n");
- return (-1);
+ return -1;
}
*cmd_id = atoi(hdr);
hdr = csv_field_iter_next(&fld);
if (hdr == NULL) {
DLOG("malformed CSV\n");
- return (-1);
+ return -1;
}
/* remove leading spaces */
for (i = j = 0; i < csv_field_len(fld); i++) {
}
client_name[j] = '\0';
- return (0);
+ return 0;
}
int ptm_lib_append_msg(ptm_lib_handle_t *hdl, void *ctxt, const char *key,
if (!csv) {
DLOG("Cannot allocate csv for hdr\n");
- return (-1);
+ return -1;
}
rc = _ptm_lib_decode_header(csv, &msglen, &ver, &type, &cmd_id,
/* we only support the get-status cmd */
if (strcmp(inbuf, PTMLIB_CMD_GET_STATUS)) {
DLOG("unsupported legacy cmd %s\n", inbuf);
- return (-1);
+ return -1;
}
/* internally create a csv-style cmd */
ptm_lib_init_msg(hdl, 0, PTMLIB_MSG_TYPE_CMD, NULL,
(void *)&p_ctxt);
if (!p_ctxt) {
DLOG("couldnt allocate context\n");
- return (-1);
+ return -1;
}
ptm_lib_append_msg(hdl, p_ctxt, "cmd", PTMLIB_CMD_GET_STATUS);
if (rule->cmd == cmd && rule->rule_str != NULL)
return (rule->rule_str);
- return (NULL);
+ return NULL;
}
static route_map_event_t get_route_map_delete_event(route_map_event_t type)
return tmp;
}
- return (NULL);
+ return NULL;
}
struct rb_entry *typed_rb_find_gteq(struct rbt_tree *rbt,
ospf6_area_stub_update(area);
}
- return (1);
+ return 1;
}
static void ospf6_area_stub_unset(struct ospf6 *ospf6, struct ospf6_area *area)
+ sizeof(struct ospf6_lsa_header));
if (!OSPF6_OPT_ISSET(rtr_lsa->options, OSPF6_OPT_R)) {
- return (OSPF6_IS_STUB_ROUTER);
+ return OSPF6_IS_STUB_ROUTER;
} else if (!OSPF6_OPT_ISSET(rtr_lsa->options, OSPF6_OPT_V6)) {
- return (OSPF6_IS_STUB_ROUTER_V6);
+ return OSPF6_IS_STUB_ROUTER_V6;
}
}
- return (OSPF6_NOT_STUB_ROUTER);
+ return OSPF6_NOT_STUB_ROUTER;
}
int ospf6_router_lsa_originate(struct thread *thread)
prefixnum = ntohl(link_lsa->prefix_num);
if (pos > prefixnum)
- return (NULL);
+ return NULL;
start = (char *)link_lsa + sizeof(struct ospf6_link_lsa);
end = (char *)lsa->header + ntohs(lsa->header->length);
prefix = (struct ospf6_prefix *)current;
if (prefix->prefix_length == 0
|| current + OSPF6_PREFIX_SIZE(prefix) > end) {
- return (NULL);
+ return NULL;
}
if (cnt < pos) {
}
} while (current <= end);
}
- return (NULL);
+ return NULL;
}
static int ospf6_link_lsa_show(struct vty *vty, struct ospf6_lsa *lsa)
prefixnum = ntohs(intra_prefix_lsa->prefix_num);
if (pos > prefixnum)
- return (NULL);
+ return NULL;
start = (char *)intra_prefix_lsa
+ sizeof(struct ospf6_intra_prefix_lsa);
return nh->ifindex;
}
- return (-1);
+ return -1;
}
int ospf6_nexthop_cmp(struct ospf6_nexthop *a, struct ospf6_nexthop *b)
frr_run(master);
/* Not reached. */
- return (0);
+ return 0;
}
frr_run(master);
/* Not reached. */
- return (0);
+ return 0;
}
if (confp == NULL) {
fprintf(stderr, "%% Can't open config file %s due to '%s'.\n",
filename, safe_strerror(errno));
- return (CMD_ERR_NO_FILE);
+ return CMD_ERR_NO_FILE;
}
vty = vty_new();
if (confp != stdin)
fclose(confp);
- return (0);
+ return 0;
}
/* Configration make from file. */
fprintf(stderr,
"%% Can't open configuration file %s due to '%s'.\n",
config_default_dir, safe_strerror(errno));
- return (CMD_ERR_NO_FILE);
+ return CMD_ERR_NO_FILE;
}
ret = vtysh_read_file(confp);
if (!inputfile) {
fprintf(stderr,
"-f option MUST be specified with -m option\n");
- return (1);
+ return 1;
}
return (vtysh_mark_file(inputfile));
}
if (!is_zebra_valid_kernel_table(table_id)
|| (table_id == RT_TABLE_MAIN))
- return (-1);
+ return -1;
if (afi >= AFI_MAX)
- return (-1);
+ return -1;
table = zebra_vrf_get_table_with_table_id(afi, SAFI_UNICAST, vrf_id,
table_id);
}
}
- return (0);
+ return 0;
}
enum zebra_dplane_result kernel_lsp_update(struct zebra_dplane_ctx *ctx)
ptm_cb.t_timer = NULL;
thread_add_timer(zrouter.master, zebra_ptm_connect, NULL,
ptm_cb.reconnect_time, &ptm_cb.t_timer);
- return (-1);
+ return -1;
case BUFFER_PENDING:
ptm_cb.t_write = NULL;
thread_add_write(zrouter.master, zebra_ptm_flush_messages, NULL,
break;
}
- return (0);
+ return 0;
}
static int zebra_ptm_send_message(char *data, int size)
thread_add_timer(zrouter.master, zebra_ptm_connect, NULL,
ptm_cb.reconnect_time,
&ptm_cb.t_timer);
- return (-1);
+ return -1;
}
ptm_cb.t_read = NULL;
* 1) VRF Aware <sigh>
* 2) Route-map aware
*/
- return (0);
+ return 0;
}
static void zebra_route_map_set_delay_timer(uint32_t value)