From 0c083ee9d870bf02a36563ae1807f3894ac24219 Mon Sep 17 00:00:00 2001 From: paul Date: Sun, 10 Oct 2004 12:54:58 +0000 Subject: 2004-10-10 Paul Jakma * ospf6_route.c: Add const qualifier to various char arrays of constants. signed/unsigned fixes. (ospf6_linkstate_table_show) argv is const * ospf6_snmp.c: listnode typedef is dead. (ospf6_snmp_init) Take struct thread_master arg, needed for smux_init. * ospf6_snmp.h: update ospf6_snmp_init declaration. * ospf6d.c: (ospf6_init) add const qualifier to sargv, pass master to ospf_snmp6_init. * ospf6_asbr.c: const char update. * ospf6_interface.c: ditto, plus signed/unsigned fixes. (ipv6_ospf6_cost) Check whether cost fits in u_int32_t and use strtoul. * ospf6_intra.c: const char update. Parenthesise expression. * ospf6_lsa.c: signed/unsigned and const char updates. * ospf6_proto.c: ditto. * ospf6_message.c: ditto. * ospf6_lsdb.c: signed/unsigned update. * ospf6_main.c: const char update. * ospf6_neighbor.c: ditto. * ospf6_spf.c: ditto. * ospf6_top.c: ditto. --- ospf6d/ospf6_message.c | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'ospf6d/ospf6_message.c') diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index d4a60dd9..e436867e 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -43,7 +43,7 @@ #include "ospf6d.h" unsigned char conf_debug_ospf6_message[6] = {0x03, 0, 0, 0, 0, 0}; -char *ospf6_message_type_str[] = +const char *ospf6_message_type_str[] = { "Unknown", "Hello", "DbDesc", "LSReq", "LSUpdate", "LSAck" }; /* print functions */ @@ -1160,12 +1160,12 @@ ospf6_lsack_recv (struct in6_addr *src, struct in6_addr *dst, } } -char *recvbuf = NULL; -char *sendbuf = NULL; -int iobuflen = 0; +u_char *recvbuf = NULL; +u_char *sendbuf = NULL; +unsigned int iobuflen = 0; int -ospf6_iobuf_size (int size) +ospf6_iobuf_size (unsigned int size) { char *recvnew, *sendnew; @@ -1198,7 +1198,8 @@ ospf6_iobuf_size (int size) int ospf6_receive (struct thread *thread) { - int sockfd, len; + int sockfd; + unsigned int len; char srcname[64], dstname[64]; struct in6_addr src, dst; unsigned int ifindex; @@ -1386,7 +1387,7 @@ ospf6_hello_send (struct thread *thread) struct ospf6_interface *oi; struct ospf6_header *oh; struct ospf6_hello *hello; - char *p; + u_char *p; struct listnode *node; struct ospf6_neighbor *on; @@ -1452,7 +1453,7 @@ ospf6_dbdesc_send (struct thread *thread) struct ospf6_neighbor *on; struct ospf6_header *oh; struct ospf6_dbdesc *dbdesc; - char *p; + u_char *p; struct ospf6_lsa *lsa; on = (struct ospf6_neighbor *) THREAD_ARG (thread); @@ -1568,7 +1569,7 @@ ospf6_lsreq_send (struct thread *thread) struct ospf6_neighbor *on; struct ospf6_header *oh; struct ospf6_lsreq_entry *e; - char *p; + u_char *p; struct ospf6_lsa *lsa; on = (struct ospf6_neighbor *) THREAD_ARG (thread); @@ -1632,7 +1633,7 @@ ospf6_lsupdate_send_neighbor (struct thread *thread) struct ospf6_neighbor *on; struct ospf6_header *oh; struct ospf6_lsupdate *lsupdate; - char *p; + u_char *p; int num; struct ospf6_lsa *lsa; @@ -1673,7 +1674,8 @@ ospf6_lsupdate_send_neighbor (struct thread *thread) lsa = ospf6_lsdb_next (lsa)) { /* MTU check */ - if (p - sendbuf + OSPF6_LSA_SIZE (lsa->header) > on->ospf6_if->ifmtu) + if ( (p - sendbuf + (unsigned int)OSPF6_LSA_SIZE (lsa->header)) + > on->ospf6_if->ifmtu) { ospf6_lsa_unlock (lsa); break; @@ -1692,7 +1694,8 @@ ospf6_lsupdate_send_neighbor (struct thread *thread) lsa = ospf6_lsdb_next (lsa)) { /* MTU check */ - if (p - sendbuf + OSPF6_LSA_SIZE (lsa->header) > on->ospf6_if->ifmtu) + if ( (p - sendbuf + (unsigned int)OSPF6_LSA_SIZE (lsa->header)) + > on->ospf6_if->ifmtu) { ospf6_lsa_unlock (lsa); break; @@ -1733,7 +1736,7 @@ ospf6_lsupdate_send_interface (struct thread *thread) struct ospf6_interface *oi; struct ospf6_header *oh; struct ospf6_lsupdate *lsupdate; - char *p; + u_char *p; int num; struct ospf6_lsa *lsa; @@ -1764,7 +1767,8 @@ ospf6_lsupdate_send_interface (struct thread *thread) lsa = ospf6_lsdb_next (lsa)) { /* MTU check */ - if (p - sendbuf + OSPF6_LSA_SIZE (lsa->header) > oi->ifmtu) + if ( (p - sendbuf + ((unsigned int)OSPF6_LSA_SIZE (lsa->header))) + > oi->ifmtu) { ospf6_lsa_unlock (lsa); break; @@ -1804,7 +1808,7 @@ ospf6_lsack_send_neighbor (struct thread *thread) { struct ospf6_neighbor *on; struct ospf6_header *oh; - char *p; + u_char *p; struct ospf6_lsa *lsa; on = (struct ospf6_neighbor *) THREAD_ARG (thread); @@ -1864,7 +1868,7 @@ ospf6_lsack_send_interface (struct thread *thread) { struct ospf6_interface *oi; struct ospf6_header *oh; - char *p; + u_char *p; struct ospf6_lsa *lsa; oi = (struct ospf6_interface *) THREAD_ARG (thread); @@ -2082,7 +2086,7 @@ ALIAS (no_debug_ospf6_message, int config_write_ospf6_debug_message (struct vty *vty) { - char *type_str[] = {"unknown", "hello", "dbdesc", + const char *type_str[] = {"unknown", "hello", "dbdesc", "lsreq", "lsupdate", "lsack"}; unsigned char s = 0, r = 0; int i; -- cgit v1.2.1