summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/command.c2
-rw-r--r--lib/hash.c1
-rw-r--r--lib/if.c19
-rw-r--r--lib/keychain.c8
-rw-r--r--lib/sockunion.c16
5 files changed, 23 insertions, 23 deletions
diff --git a/lib/command.c b/lib/command.c
index 97eba96c3a..2e91d84bf3 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -1367,7 +1367,7 @@ DEFUN (config_quit,
DEFUN (config_end,
config_end_cmd,
"end",
- "End current mode and change to enable mode.")
+ "End current mode and change to enable mode.\n")
{
switch (vty->node) {
case VIEW_NODE:
diff --git a/lib/hash.c b/lib/hash.c
index f222279216..4894b65aff 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -395,6 +395,7 @@ DEFUN_NOSH(show_hash_stats,
pthread_mutex_lock(&_hashes_mtx);
if (!_hashes) {
pthread_mutex_unlock(&_hashes_mtx);
+ ttable_del(tt);
vty_out(vty, "No hash tables in use.\n");
return CMD_SUCCESS;
}
diff --git a/lib/if.c b/lib/if.c
index 320dfba4b5..0fe7da1c0d 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -194,7 +194,10 @@ void if_delete_retain(struct interface *ifp)
/* Delete and free interface structure. */
void if_delete(struct interface *ifp)
{
- struct vrf *vrf = vrf_lookup_by_id(ifp->vrf_id);
+ struct vrf *vrf;
+
+ vrf = vrf_lookup_by_id(ifp->vrf_id);
+ assert(vrf);
IFNAME_RB_REMOVE(vrf, ifp);
if (ifp->ifindex != IFINDEX_INTERNAL)
@@ -213,9 +216,13 @@ void if_delete(struct interface *ifp)
/* Interface existance check by index. */
struct interface *if_lookup_by_index(ifindex_t ifindex, vrf_id_t vrf_id)
{
- struct vrf *vrf = vrf_lookup_by_id(vrf_id);
+ struct vrf *vrf;
struct interface if_tmp;
+ vrf = vrf_lookup_by_id(vrf_id);
+ if (!vrf)
+ return NULL;
+
if_tmp.ifindex = ifindex;
return RB_FIND(if_index_head, &vrf->ifaces_by_index, &if_tmp);
}
@@ -244,7 +251,8 @@ struct interface *if_lookup_by_name(const char *name, vrf_id_t vrf_id)
struct vrf *vrf = vrf_lookup_by_id(vrf_id);
struct interface if_tmp;
- if (!name || strnlen(name, INTERFACE_NAMSIZ) == INTERFACE_NAMSIZ)
+ if (!vrf || !name
+ || strnlen(name, INTERFACE_NAMSIZ) == INTERFACE_NAMSIZ)
return NULL;
strlcpy(if_tmp.name, name, sizeof(if_tmp.name));
@@ -388,7 +396,10 @@ struct interface *if_get_by_name(const char *name, vrf_id_t vrf_id, int vty)
void if_set_index(struct interface *ifp, ifindex_t ifindex)
{
- struct vrf *vrf = vrf_lookup_by_id(ifp->vrf_id);
+ struct vrf *vrf;
+
+ vrf = vrf_lookup_by_id(ifp->vrf_id);
+ assert(vrf);
if (ifp->ifindex == ifindex)
return;
diff --git a/lib/keychain.c b/lib/keychain.c
index 23a2d72b17..bb2c173354 100644
--- a/lib/keychain.c
+++ b/lib/keychain.c
@@ -633,7 +633,7 @@ DEFUN (accept_lifetime_infinite_day_month,
"Day of th month to start\n"
"Month of the year to start\n"
"Year to start\n"
- "Never expires")
+ "Never expires\n")
{
int idx_hhmmss = 1;
int idx_number = 2;
@@ -654,7 +654,7 @@ DEFUN (accept_lifetime_infinite_month_day,
"Month of the year to start\n"
"Day of th month to start\n"
"Year to start\n"
- "Never expires")
+ "Never expires\n")
{
int idx_hhmmss = 1;
int idx_month = 2;
@@ -843,7 +843,7 @@ DEFUN (send_lifetime_infinite_day_month,
"Day of th month to start\n"
"Month of the year to start\n"
"Year to start\n"
- "Never expires")
+ "Never expires\n")
{
int idx_hhmmss = 1;
int idx_number = 2;
@@ -864,7 +864,7 @@ DEFUN (send_lifetime_infinite_month_day,
"Month of the year to start\n"
"Day of th month to start\n"
"Year to start\n"
- "Never expires")
+ "Never expires\n")
{
int idx_hhmmss = 1;
int idx_month = 2;
diff --git a/lib/sockunion.c b/lib/sockunion.c
index 559ae37ffb..ab8d8be3e5 100644
--- a/lib/sockunion.c
+++ b/lib/sockunion.c
@@ -175,15 +175,11 @@ static int sockunion_sizeof(const union sockunion *su)
return ret;
}
-/* sockunion_connect returns
- -1 : error occured
- 0 : connect success
- 1 : connect is in progress */
+/* Performs a non-blocking connect(). */
enum connect_result sockunion_connect(int fd, const union sockunion *peersu,
unsigned short port, ifindex_t ifindex)
{
int ret;
- int val;
union sockunion su;
memcpy(&su, peersu, sizeof(union sockunion));
@@ -203,18 +199,12 @@ enum connect_result sockunion_connect(int fd, const union sockunion *peersu,
break;
}
- /* Make socket non-block. */
- val = fcntl(fd, F_GETFL, 0);
- fcntl(fd, F_SETFL, val | O_NONBLOCK);
-
/* Call connect function. */
ret = connect(fd, (struct sockaddr *)&su, sockunion_sizeof(&su));
/* Immediate success */
- if (ret == 0) {
- fcntl(fd, F_SETFL, val);
+ if (ret == 0)
return connect_success;
- }
/* If connect is in progress then return 1 else it's real error. */
if (ret < 0) {
@@ -227,8 +217,6 @@ enum connect_result sockunion_connect(int fd, const union sockunion *peersu,
}
}
- fcntl(fd, F_SETFL, val);
-
return connect_in_progress;
}