summaryrefslogtreecommitdiff
path: root/ospfclient/ospfclient.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospfclient/ospfclient.c')
-rw-r--r--ospfclient/ospfclient.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/ospfclient/ospfclient.c b/ospfclient/ospfclient.c
index e70b776407..5713105f42 100644
--- a/ospfclient/ospfclient.c
+++ b/ospfclient/ospfclient.c
@@ -10,10 +10,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with Quagga; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
@@ -90,7 +89,11 @@ static int 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, area_id,
@@ -117,8 +120,17 @@ static int 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]);
@@ -159,7 +171,7 @@ static int lsa_read(struct thread *thread)
}
/* Reschedule read thread */
- thread_add_read(master, lsa_read, oclient, fd);
+ thread_add_read(master, lsa_read, oclient, fd, NULL);
return 0;
}
@@ -213,13 +225,13 @@ static void ready_callback(u_char lsa_type, u_char opaque_type,
lsa_type, opaque_type, inet_ntoa(addr));
/* Schedule opaque LSA originate in 5 secs */
- thread_add_timer(master, lsa_inject, oclient, 5);
+ thread_add_timer(master, lsa_inject, oclient, 5, NULL);
/* Schedule opaque LSA update with new value */
- thread_add_timer(master, lsa_inject, oclient, 10);
+ thread_add_timer(master, lsa_inject, oclient, 10, NULL);
/* Schedule delete */
- thread_add_timer(master, lsa_delete, oclient, 30);
+ thread_add_timer(master, lsa_delete, oclient, 30, NULL);
}
static void new_if_callback(struct in_addr ifaddr, struct in_addr area_id)
@@ -296,7 +308,7 @@ int main(int argc, char *argv[])
/* Initialization */
zprivs_init(&ospfd_privs);
- master = thread_master_create();
+ master = thread_master_create(NULL);
/* Open connection to OSPF daemon */
oclient = ospf_apiclient_connect(args[1], ASYNCPORT);
@@ -319,7 +331,7 @@ int main(int argc, char *argv[])
ospf_apiclient_sync_lsdb(oclient);
/* Schedule thread that handles asynchronous messages */
- thread_add_read(master, lsa_read, oclient, oclient->fd_async);
+ thread_add_read(master, lsa_read, oclient, oclient->fd_async, NULL);
/* Now connection is established, run loop */
while (1) {