newseq = ((maxseq / 5) * 5) + 5;
- return newseq;
+ return (newseq > UINT_MAX) ? UINT_MAX : newseq;
}
/* Return prefix list entry which has same seq number. */
}
static int prefix_list_entry_match(struct prefix_list_entry *pentry,
- struct prefix *p)
+ const struct prefix *p)
{
int ret;
return 1;
}
-enum prefix_list_type prefix_list_apply_which_prefix(struct prefix_list *plist,
- struct prefix **which,
- void *object)
+enum prefix_list_type prefix_list_apply_which_prefix(
+ struct prefix_list *plist,
+ const struct prefix **which,
+ const void *object)
{
struct prefix_list_entry *pentry, *pbest = NULL;
- struct prefix *p = (struct prefix *)object;
- uint8_t *byte = p->u.val;
+ const struct prefix *p = (const struct prefix *)object;
+ const uint8_t *byte = p->u.val;
size_t depth;
size_t validbits = p->prefixlen;
struct pltrie_table *table;
int lenum = 0;
int genum = 0;
+ if (name == NULL || prefix == NULL || typestr == NULL) {
+ vty_out(vty, "%% Missing prefix or type\n");
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+
/* Sequential number. */
if (seq)
seqnum = (int64_t)atol(seq);
char buf_tmp[PREFIX2STR_BUFFER];
prefix2str(&p, buf, sizeof(buf));
prefix2str(&p_tmp, buf_tmp, sizeof(buf_tmp));
- zlog_warn(
+ vty_out(vty,
+ "%% Prefix-list %s prefix changed from %s to %s to match length\n",
+ name, buf, buf_tmp);
+ zlog_info(
"Prefix-list %s prefix changed from %s to %s to match length",
name, buf, buf_tmp);
p = p_tmp;
if (pentry->any)
vty_out(vty, "any");
else {
- struct prefix *p = &pentry->prefix;
+ struct prefix *pf = &pentry->prefix;
char buf[BUFSIZ];
vty_out(vty, "%s/%d",
- inet_ntop(p->family, p->u.val, buf,
+ inet_ntop(pf->family, pf->u.val, buf,
BUFSIZ),
- p->prefixlen);
+ pf->prefixlen);
if (pentry->ge)
vty_out(vty, " ge %d", pentry->ge);
/* return prefix count */
int prefix_bgp_show_prefix_list(struct vty *vty, afi_t afi, char *name,
- uint8_t use_json)
+ bool use_json)
{
struct prefix_list *plist;
struct prefix_list_entry *pentry;