diff options
Diffstat (limited to 'ospfclient')
| -rw-r--r-- | ospfclient/ospf_apiclient.c | 5 | ||||
| -rw-r--r-- | ospfclient/ospfclient.c | 26 |
2 files changed, 26 insertions, 5 deletions
diff --git a/ospfclient/ospf_apiclient.c b/ospfclient/ospf_apiclient.c index 0ebae087e3..3f3b5511a2 100644 --- a/ospfclient/ospf_apiclient.c +++ b/ospfclient/ospf_apiclient.c @@ -183,6 +183,7 @@ ospf_apiclient_connect (char *host, int syncport) fd1 = socket (AF_INET, SOCK_STREAM, 0); if (fd1 < 0) { + close (async_server_sock); fprintf (stderr, "ospf_apiclient_connect: creating sync socket failed\n"); return NULL; @@ -196,6 +197,7 @@ ospf_apiclient_connect (char *host, int syncport) { fprintf (stderr, "ospf_apiclient_connect: SO_REUSEADDR failed\n"); close (fd1); + close (async_server_sock); return NULL; } @@ -206,6 +208,7 @@ ospf_apiclient_connect (char *host, int syncport) { fprintf (stderr, "ospf_apiclient_connect: SO_REUSEPORT failed\n"); close (fd1); + close (async_server_sock); return NULL; } #endif /* SO_REUSEPORT */ @@ -227,6 +230,7 @@ ospf_apiclient_connect (char *host, int syncport) { fprintf (stderr, "ospf_apiclient_connect: bind sync socket failed\n"); close (fd1); + close (async_server_sock); return NULL; } @@ -260,6 +264,7 @@ ospf_apiclient_connect (char *host, int syncport) fprintf (stderr, "ospf_apiclient_connect: accept async failed\n"); close (async_server_sock); close (fd1); + close (fd2); return NULL; } diff --git a/ospfclient/ospfclient.c b/ospfclient/ospfclient.c index 195fd5b5a0..affcbc9d6a 100644 --- a/ospfclient/ospfclient.c +++ b/ospfclient/ospfclient.c @@ -94,7 +94,12 @@ lsa_delete (struct thread *t) oclient = THREAD_ARG (t); - inet_aton (args[6], &area_id); + rc = inet_aton (args[6], &area_id); + if (rc <= 0) + { + printf("Address Specified: %s is invalid\n", args[6]); + return rc; + } printf ("Deleting LSA... "); rc = ospf_apiclient_lsa_delete (oclient, @@ -123,8 +128,19 @@ lsa_inject (struct thread *t) cl = THREAD_ARG (t); - inet_aton (args[5], &ifaddr); - inet_aton (args[6], &area_id); + rc = inet_aton (args[5], &ifaddr); + if (rc <= 0) + { + printf ("Ifaddr specified %s is invalid\n", args[5]); + return rc; + } + + rc = inet_aton (args[6], &area_id); + if (rc <= 0) + { + printf( "Area ID specified %s is invalid\n", args[6]); + return rc; + } lsa_type = atoi (args[2]); opaque_type = atoi (args[3]); opaque_id = atoi (args[4]); @@ -251,7 +267,7 @@ ism_change_callback (struct in_addr ifaddr, struct in_addr area_id, { printf ("ism_change: ifaddr: %s ", inet_ntoa (ifaddr)); printf ("area_id: %s\n", inet_ntoa (area_id)); - printf ("state: %d [%s]\n", state, LOOKUP (ospf_ism_state_msg, state)); + printf ("state: %d [%s]\n", state, lookup_msg(ospf_ism_state_msg, state, NULL)); } static void @@ -261,7 +277,7 @@ nsm_change_callback (struct in_addr ifaddr, struct in_addr nbraddr, printf ("nsm_change: ifaddr: %s ", inet_ntoa (ifaddr)); printf ("nbraddr: %s\n", inet_ntoa (nbraddr)); printf ("router_id: %s\n", inet_ntoa (router_id)); - printf ("state: %d [%s]\n", state, LOOKUP (ospf_nsm_state_msg, state)); + printf ("state: %d [%s]\n", state, lookup_msg(ospf_nsm_state_msg, state, NULL)); } |
