summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ferr.c2
-rw-r--r--lib/frrcu.c5
-rw-r--r--lib/if.c28
-rw-r--r--lib/if.h6
-rw-r--r--lib/libfrr.c2
-rw-r--r--lib/northbound.h9
-rw-r--r--lib/northbound_cli.c14
-rw-r--r--lib/prefix.c8
-rw-r--r--lib/stream.c8
-rw-r--r--lib/stream.h5
-rw-r--r--lib/thread.c2
-rw-r--r--lib/vty.c9
-rw-r--r--lib/zclient.c11
-rw-r--r--lib/zebra.h1
14 files changed, 57 insertions, 53 deletions
diff --git a/lib/ferr.c b/lib/ferr.c
index 8afc926c41..fd5fb50172 100644
--- a/lib/ferr.c
+++ b/lib/ferr.c
@@ -170,7 +170,7 @@ void log_ref_display(struct vty *vty, uint32_t code, bool json)
DEFUN_NOSH(show_error_code,
show_error_code_cmd,
- "show error <(1-4294967296)|all> [json]",
+ "show error <(1-4294967295)|all> [json]",
SHOW_STR
"Information on errors\n"
"Error code to get info about\n"
diff --git a/lib/frrcu.c b/lib/frrcu.c
index 7e6475b648..54626f909d 100644
--- a/lib/frrcu.c
+++ b/lib/frrcu.c
@@ -55,7 +55,6 @@
#include "atomlist.h"
DEFINE_MTYPE_STATIC(LIB, RCU_THREAD, "RCU thread")
-DEFINE_MTYPE_STATIC(LIB, RCU_NEXT, "RCU sequence barrier")
DECLARE_ATOMLIST(rcu_heads, struct rcu_head, head)
@@ -226,7 +225,7 @@ static void rcu_bump(void)
{
struct rcu_next *rn;
- rn = XMALLOC(MTYPE_RCU_NEXT, sizeof(*rn));
+ rn = XMALLOC(MTYPE_RCU_THREAD, sizeof(*rn));
/* note: each RCUA_NEXT item corresponds to exactly one seqno bump.
* This means we don't need to communicate which seqno is which
@@ -269,7 +268,7 @@ static void rcu_bump(void)
* "last item is being deleted - start over" case, and then we may end
* up accessing old RCU queue items that are already free'd.
*/
- rcu_free_internal(MTYPE_RCU_NEXT, rn, head_free);
+ rcu_free_internal(MTYPE_RCU_THREAD, rn, head_free);
/* Only allow the RCU sweeper to run after these 2 items are queued.
*
diff --git a/lib/if.c b/lib/if.c
index 9ee2f02e62..5f92327562 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -45,6 +45,8 @@ DEFINE_MTYPE_STATIC(LIB, NBR_CONNECTED, "Neighbor Connected")
DEFINE_MTYPE(LIB, CONNECTED_LABEL, "Connected interface label")
DEFINE_MTYPE_STATIC(LIB, IF_LINK_PARAMS, "Informational Link Parameters")
+static struct interface *if_lookup_by_ifindex(ifindex_t ifindex,
+ vrf_id_t vrf_id);
static int if_cmp_func(const struct interface *, const struct interface *);
static int if_cmp_index_func(const struct interface *ifp1,
const struct interface *ifp2);
@@ -257,8 +259,9 @@ void if_delete(struct interface *ifp)
XFREE(MTYPE_IF, ifp);
}
-/* Interface existance check by index. */
-struct interface *if_lookup_by_index(ifindex_t ifindex, vrf_id_t vrf_id)
+/* Used only internally to check within VRF only */
+static struct interface *if_lookup_by_ifindex(ifindex_t ifindex,
+ vrf_id_t vrf_id)
{
struct vrf *vrf;
struct interface if_tmp;
@@ -271,6 +274,19 @@ struct interface *if_lookup_by_index(ifindex_t ifindex, vrf_id_t vrf_id)
return RB_FIND(if_index_head, &vrf->ifaces_by_index, &if_tmp);
}
+/* Interface existance check by index. */
+struct interface *if_lookup_by_index(ifindex_t ifindex, vrf_id_t vrf_id)
+{
+ switch (vrf_get_backend()) {
+ case VRF_BACKEND_UNKNOWN:
+ case VRF_BACKEND_NETNS:
+ return(if_lookup_by_ifindex(ifindex, vrf_id));
+ case VRF_BACKEND_VRF_LITE:
+ return(if_lookup_by_index_all_vrf(ifindex));
+ }
+ return NULL;
+}
+
const char *ifindex2ifname(ifindex_t ifindex, vrf_id_t vrf_id)
{
struct interface *ifp;
@@ -329,7 +345,7 @@ struct interface *if_lookup_by_index_all_vrf(ifindex_t ifindex)
return NULL;
RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
- ifp = if_lookup_by_index(ifindex, vrf->vrf_id);
+ ifp = if_lookup_by_ifindex(ifindex, vrf->vrf_id);
if (ifp)
return ifp;
}
@@ -337,7 +353,7 @@ struct interface *if_lookup_by_index_all_vrf(ifindex_t ifindex)
return NULL;
}
-/* Lookup interface by IPv4 address. */
+/* Lookup interface by IP address. */
struct interface *if_lookup_exact_address(void *src, int family,
vrf_id_t vrf_id)
{
@@ -369,7 +385,7 @@ struct interface *if_lookup_exact_address(void *src, int family,
return NULL;
}
-/* Lookup interface by IPv4 address. */
+/* Lookup interface by IP address. */
struct connected *if_lookup_address(void *matchaddr, int family,
vrf_id_t vrf_id)
{
@@ -489,7 +505,7 @@ struct interface *if_get_by_ifindex(ifindex_t ifindex, vrf_id_t vrf_id)
switch (vrf_get_backend()) {
case VRF_BACKEND_UNKNOWN:
case VRF_BACKEND_NETNS:
- ifp = if_lookup_by_index(ifindex, vrf_id);
+ ifp = if_lookup_by_ifindex(ifindex, vrf_id);
if (ifp)
return ifp;
return if_create_ifindex(ifindex, vrf_id);
diff --git a/lib/if.h b/lib/if.h
index 871e319f29..e3ec278f9f 100644
--- a/lib/if.h
+++ b/lib/if.h
@@ -383,16 +383,12 @@ struct connected {
/* N.B. the ZEBRA_IFA_PEER flag should be set if and only if
a peer address has been configured. If this flag is set,
the destination field must contain the peer address.
- Otherwise, if this flag is not set, the destination address
- will either contain a broadcast address or be NULL.
*/
/* Address of connected network. */
struct prefix *address;
- /* Peer or Broadcast address, depending on whether ZEBRA_IFA_PEER is
- set.
- Note: destination may be NULL if ZEBRA_IFA_PEER is not set. */
+ /* Peer address, if ZEBRA_IFA_PEER is set, otherwise NULL */
struct prefix *destination;
/* Label for Linux 2.2.X and upper. */
diff --git a/lib/libfrr.c b/lib/libfrr.c
index 35c6092140..4301dc20ad 100644
--- a/lib/libfrr.c
+++ b/lib/libfrr.c
@@ -410,7 +410,7 @@ static int frr_opt(int opt)
}
if (di->zpathspace)
fprintf(stderr,
- "-N option overriden by -z for zebra named socket path\n");
+ "-N option overridden by -z for zebra named socket path\n");
if (strchr(optarg, '/') || strchr(optarg, '.')) {
fprintf(stderr,
diff --git a/lib/northbound.h b/lib/northbound.h
index 69d7c8e0ee..ce79d907f9 100644
--- a/lib/northbound.h
+++ b/lib/northbound.h
@@ -347,15 +347,6 @@ struct nb_callbacks {
* dnode
* libyang data node that should be shown in the form of a CLI
* command.
- *
- * show_defaults
- * Specify whether to display default configuration values or not.
- * This parameter can be ignored most of the time since the
- * northbound doesn't call this callback for default leaves or
- * non-presence containers that contain only default child nodes.
- * The exception are commands associated to multiple configuration
- * nodes, in which case it might be desirable to hide one or more
- * parts of the command when this parameter is set to false.
*/
void (*cli_show_end)(struct vty *vty, struct lyd_node *dnode);
};
diff --git a/lib/northbound_cli.c b/lib/northbound_cli.c
index c691bb27aa..884c01a457 100644
--- a/lib/northbound_cli.c
+++ b/lib/northbound_cli.c
@@ -757,7 +757,7 @@ DEFPY (config_load,
"configuration load\
<\
file [<json$json|xml$xml> [translate WORD$translator_family]] FILENAME$filename\
- |transaction (1-4294967296)$tid\
+ |transaction (1-4294967295)$tid\
>\
[replace$replace]",
"Configuration related settings\n"
@@ -923,12 +923,12 @@ DEFPY (show_config_compare,
<\
candidate$c1_candidate\
|running$c1_running\
- |transaction (1-4294967296)$c1_tid\
+ |transaction (1-4294967295)$c1_tid\
>\
<\
candidate$c2_candidate\
|running$c2_running\
- |transaction (1-4294967296)$c2_tid\
+ |transaction (1-4294967295)$c2_tid\
>\
[<json$json|xml$xml> [translate WORD$translator_family]]",
SHOW_STR
@@ -1029,11 +1029,11 @@ ALIAS (show_config_compare,
"show configuration compare\
<\
running$c1_running\
- |transaction (1-4294967296)$c1_tid\
+ |transaction (1-4294967295)$c1_tid\
>\
<\
running$c2_running\
- |transaction (1-4294967296)$c2_tid\
+ |transaction (1-4294967295)$c2_tid\
>\
[<json$json|xml$xml> [translate WORD$translator_family]]",
SHOW_STR
@@ -1192,7 +1192,7 @@ DEFPY (show_config_transaction,
show_config_transaction_cmd,
"show configuration transaction\
[\
- (1-4294967296)$transaction_id\
+ (1-4294967295)$transaction_id\
[<json$json|xml$xml> [translate WORD$translator_family]]\
[<\
with-defaults$with_defaults\
@@ -1593,7 +1593,7 @@ static int nb_cli_rollback_configuration(struct vty *vty,
DEFPY (rollback_config,
rollback_config_cmd,
- "rollback configuration (1-4294967296)$transaction_id",
+ "rollback configuration (1-4294967295)$transaction_id",
"Rollback to a previous state\n"
"Running configuration\n"
"Transaction ID\n")
diff --git a/lib/prefix.c b/lib/prefix.c
index 1a4a914e05..ad8dea273e 100644
--- a/lib/prefix.c
+++ b/lib/prefix.c
@@ -853,7 +853,7 @@ void prefix_ipv4_free(struct prefix_ipv4 *p)
prefix_free((struct prefix *)p);
}
-/* When string format is invalid return 0. */
+/* If given string is valid return 1 else return 0 */
int str2prefix_ipv4(const char *str, struct prefix_ipv4 *p)
{
int ret;
@@ -881,8 +881,10 @@ int str2prefix_ipv4(const char *str, struct prefix_ipv4 *p)
cp = XMALLOC(MTYPE_TMP, (pnt - str) + 1);
memcpy(cp, str, pnt - str);
*(cp + (pnt - str)) = '\0';
- ret = inet_aton(cp, &p->prefix);
+ ret = inet_pton(AF_INET, cp, &p->prefix);
XFREE(MTYPE_TMP, cp);
+ if (ret == 0)
+ return 0;
/* Get prefix length. */
plen = (uint8_t)atoi(++pnt);
@@ -1023,7 +1025,7 @@ void prefix_ipv6_free(struct prefix_ipv6 *p)
prefix_free((struct prefix *)p);
}
-/* If given string is valid return pin6 else return NULL */
+/* If given string is valid return 1 else return 0 */
int str2prefix_ipv6(const char *str, struct prefix_ipv6 *p)
{
char *pnt;
diff --git a/lib/stream.c b/lib/stream.c
index c67bc3c993..dfd13ca186 100644
--- a/lib/stream.c
+++ b/lib/stream.c
@@ -186,14 +186,6 @@ size_t stream_resize_inplace(struct stream **sptr, size_t newsize)
return orig->size;
}
-size_t __attribute__((deprecated))stream_resize_orig(struct stream *s,
- size_t newsize)
-{
- assert("stream_resize: Switch code to use stream_resize_inplace" == NULL);
-
- return stream_resize_inplace(&s, newsize);
-}
-
size_t stream_get_getp(struct stream *s)
{
STREAM_VERIFY_SANE(s);
diff --git a/lib/stream.h b/lib/stream.h
index a903ec0ea5..1144e43ef0 100644
--- a/lib/stream.h
+++ b/lib/stream.h
@@ -153,11 +153,6 @@ extern void stream_free(struct stream *);
extern struct stream *stream_copy(struct stream *, struct stream *src);
extern struct stream *stream_dup(struct stream *);
-#if CONFDATE > 20190821
-CPP_NOTICE("lib: time to remove stream_resize_orig")
-#endif
-extern size_t stream_resize_orig(struct stream *s, size_t newsize);
-#define stream_resize stream_resize_orig
extern size_t stream_resize_inplace(struct stream **sptr, size_t newsize);
extern size_t stream_get_getp(struct stream *);
diff --git a/lib/thread.c b/lib/thread.c
index 5756ebc1f9..943b849ebf 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -714,7 +714,7 @@ static int fd_poll(struct thread_master *m, struct pollfd *pfds, nfds_t pfdsize,
{
/* If timer_wait is null here, that means poll() should block
* indefinitely,
- * unless the thread_master has overriden it by setting
+ * unless the thread_master has overridden it by setting
* ->selectpoll_timeout.
* If the value is positive, it specifies the maximum number of
* milliseconds
diff --git a/lib/vty.c b/lib/vty.c
index c1535802cf..deb9391bd5 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -348,6 +348,15 @@ void vty_hello(struct vty *vty)
vty_out(vty, "MOTD file not found\n");
} else if (host.motd)
vty_out(vty, "%s", host.motd);
+
+#if CONFDATE > 20200901
+ CPP_NOTICE("Please remove solaris code from system as it is deprecated");
+#endif
+#ifdef SUNOS_5
+ zlog_warn("If you are using FRR on Solaris, the FRR developers would love to hear from you\n");
+ zlog_warn("Please send email to dev@lists.frrouting.org about this message\n");
+ zlog_warn("We are considering deprecating Solaris and want to find users of Solaris systems\n");
+#endif
}
/* Put out prompt and wait input from user. */
diff --git a/lib/zclient.c b/lib/zclient.c
index 6937700199..2d79d9b3c5 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -325,8 +325,9 @@ int zclient_read_header(struct stream *s, int sock, uint16_t *size,
if (*size && stream_read(s, sock, *size) != *size)
return -1;
-stream_failure:
return 0;
+stream_failure:
+ return -1;
}
bool zapi_parse_header(struct stream *zmsg, struct zmsghdr *hdr)
@@ -1056,8 +1057,9 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api)
if (CHECK_FLAG(api->message, ZAPI_MESSAGE_TABLEID))
STREAM_GETL(s, api->tableid);
-stream_failure:
return 0;
+stream_failure:
+ return -1;
}
static void zapi_encode_prefix(struct stream *s, struct prefix *p,
@@ -2254,7 +2256,7 @@ int tm_table_manager_connect(struct zclient *zclient)
return (int)result;
stream_failure:
- return 0;
+ return -1;
}
/**
@@ -2321,8 +2323,9 @@ int tm_get_table_chunk(struct zclient *zclient, uint32_t chunk_size,
if (zclient_debug)
zlog_debug("Table Chunk assign: %u - %u ", *start, *end);
-stream_failure:
return 0;
+stream_failure:
+ return -1;
}
/**
diff --git a/lib/zebra.h b/lib/zebra.h
index 352887eca8..789a93a3c4 100644
--- a/lib/zebra.h
+++ b/lib/zebra.h
@@ -360,6 +360,7 @@ typedef enum {
/* Subsequent Address Family Identifier. */
typedef enum {
+ SAFI_UNSPEC = 0,
SAFI_UNICAST = 1,
SAFI_MULTICAST = 2,
SAFI_MPLS_VPN = 3,