diff options
Diffstat (limited to 'ospf6d')
| -rw-r--r-- | ospf6d/ospf6_bfd.c | 11 | ||||
| -rw-r--r-- | ospf6d/ospf6_flood.c | 1 | ||||
| -rw-r--r-- | ospf6d/ospf6_interface.c | 6 | ||||
| -rw-r--r-- | ospf6d/ospf6_message.c | 14 | ||||
| -rw-r--r-- | ospf6d/ospf6_neighbor.c | 4 | ||||
| -rw-r--r-- | ospf6d/ospf6_network.c | 25 | ||||
| -rw-r--r-- | ospf6d/ospf6_route.c | 4 | ||||
| -rw-r--r-- | ospf6d/ospf6_spf.c | 10 | ||||
| -rw-r--r-- | ospf6d/ospf6_zebra.c | 8 |
9 files changed, 36 insertions, 47 deletions
diff --git a/ospf6d/ospf6_bfd.c b/ospf6d/ospf6_bfd.c index 7955121365..e7284a6659 100644 --- a/ospf6d/ospf6_bfd.c +++ b/ospf6d/ospf6_bfd.c @@ -276,11 +276,14 @@ void ospf6_bfd_info_nbr_create(struct ospf6_interface *oi, */ void ospf6_bfd_write_config(struct vty *vty, struct ospf6_interface *oi) { +#if HAVE_BFDD == 0 struct bfd_info *bfd_info; +#endif /* ! HAVE_BFDD */ if (!oi->bfd_info) return; +#if HAVE_BFDD == 0 bfd_info = (struct bfd_info *)oi->bfd_info; if (CHECK_FLAG(bfd_info->flags, BFD_FLAG_PARAM_CFG)) @@ -288,6 +291,7 @@ void ospf6_bfd_write_config(struct vty *vty, struct ospf6_interface *oi) bfd_info->detect_mult, bfd_info->required_min_rx, bfd_info->desired_min_tx); else +#endif /* ! HAVE_BFDD */ vty_out(vty, " ipv6 ospf6 bfd\n"); } @@ -329,7 +333,12 @@ DEFUN (ipv6_ospf6_bfd, return CMD_SUCCESS; } -DEFUN (ipv6_ospf6_bfd_param, +#if HAVE_BFDD > 0 +DEFUN_HIDDEN( +#else +DEFUN( +#endif /* HAVE_BFDD */ + ipv6_ospf6_bfd_param, ipv6_ospf6_bfd_param_cmd, "ipv6 ospf6 bfd (2-255) (50-60000) (50-60000)", IP6_STR diff --git a/ospf6d/ospf6_flood.c b/ospf6d/ospf6_flood.c index ae26668c8a..2059d84868 100644 --- a/ospf6d/ospf6_flood.c +++ b/ospf6d/ospf6_flood.c @@ -347,7 +347,6 @@ void ospf6_flood_interface(struct ospf6_neighbor *from, struct ospf6_lsa *lsa, "Received is newer, remove requesting"); if (req == on->last_ls_req) { ospf6_lsa_unlock(req); - req = NULL; on->last_ls_req = NULL; } if (req) diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 9178bf2f6a..9777a01ae6 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -180,12 +180,6 @@ struct ospf6_interface *ospf6_interface_create(struct interface *ifp) oi = (struct ospf6_interface *)XCALLOC(MTYPE_OSPF6_IF, sizeof(struct ospf6_interface)); - if (!oi) { - zlog_err("Can't malloc ospf6_interface for ifindex %d", - ifp->ifindex); - return (struct ospf6_interface *)NULL; - } - oi->area = (struct ospf6_area *)NULL; oi->neighbor_list = list_new(); oi->neighbor_list->cmp = ospf6_neighbor_cmp; diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index c608a01102..228a525e76 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -26,6 +26,7 @@ #include "command.h" #include "thread.h" #include "linklist.h" +#include "lib_errors.h" #include "ospf6_proto.h" #include "ospf6_lsa.h" @@ -1503,14 +1504,6 @@ int ospf6_iobuf_size(unsigned int size) recvnew = XMALLOC(MTYPE_OSPF6_MESSAGE, size); sendnew = XMALLOC(MTYPE_OSPF6_MESSAGE, size); - if (recvnew == NULL || sendnew == NULL) { - if (recvnew) - XFREE(MTYPE_OSPF6_MESSAGE, recvnew); - if (sendnew) - XFREE(MTYPE_OSPF6_MESSAGE, sendnew); - zlog_debug("Could not allocate I/O buffer of size %d.", size); - return iobuflen; - } if (recvbuf) XFREE(MTYPE_OSPF6_MESSAGE, recvbuf); @@ -1566,7 +1559,8 @@ int ospf6_receive(struct thread *thread) /* receive message */ len = ospf6_recvmsg(&src, &dst, &ifindex, iovector); if (len > iobuflen) { - zlog_err("Excess message read"); + flog_err(LIB_ERR_DEVELOPMENT, + "Excess message read"); return 0; } @@ -1714,7 +1708,7 @@ static void ospf6_send(struct in6_addr *src, struct in6_addr *dst, /* send message */ len = ospf6_sendmsg(src, dst, &oi->interface->ifindex, iovector); if (len != ntohs(oh->length)) - zlog_err("Could not send entire message"); + flog_err(LIB_ERR_DEVELOPMENT, "Could not send entire message"); } static uint32_t ospf6_packet_max(struct ospf6_interface *oi) diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index b5a1812ffa..0cc7294d67 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -84,10 +84,6 @@ struct ospf6_neighbor *ospf6_neighbor_create(uint32_t router_id, on = (struct ospf6_neighbor *)XMALLOC(MTYPE_OSPF6_NEIGHBOR, sizeof(struct ospf6_neighbor)); - if (on == NULL) { - zlog_warn("neighbor: malloc failed"); - return NULL; - } memset(on, 0, sizeof(struct ospf6_neighbor)); inet_ntop(AF_INET, &router_id, buf, sizeof(buf)); diff --git a/ospf6d/ospf6_network.c b/ospf6d/ospf6_network.c index 4790d8f01e..8988a53e5d 100644 --- a/ospf6d/ospf6_network.c +++ b/ospf6d/ospf6_network.c @@ -25,6 +25,7 @@ #include "sockunion.h" #include "sockopt.h" #include "privs.h" +#include "lib_errors.h" #include "libospf.h" #include "ospf6_proto.h" @@ -75,18 +76,14 @@ static void ospf6_set_checksum(void) /* Make ospf6d's server socket. */ int ospf6_serv_sock(void) { - if (ospf6d_privs.change(ZPRIVS_RAISE)) - zlog_err("ospf6_serv_sock: could not raise privs"); - - ospf6_sock = socket(AF_INET6, SOCK_RAW, IPPROTO_OSPFIGP); - if (ospf6_sock < 0) { - zlog_warn("Network: can't create OSPF6 socket."); - if (ospf6d_privs.change(ZPRIVS_LOWER)) - zlog_err("ospf_sock_init: could not lower privs"); - return -1; + frr_elevate_privs(&ospf6d_privs) { + + ospf6_sock = socket(AF_INET6, SOCK_RAW, IPPROTO_OSPFIGP); + if (ospf6_sock < 0) { + zlog_warn("Network: can't create OSPF6 socket."); + return -1; + } } - if (ospf6d_privs.change(ZPRIVS_LOWER)) - zlog_err("ospf_sock_init: could not lower privs"); /* set socket options */ #if 1 @@ -120,8 +117,10 @@ int ospf6_sso(ifindex_t ifindex, struct in6_addr *group, int option) ret = setsockopt(ospf6_sock, IPPROTO_IPV6, option, &mreq6, sizeof(mreq6)); if (ret < 0) { - zlog_err("Network: setsockopt (%d) on ifindex %d failed: %s", - option, ifindex, safe_strerror(errno)); + flog_err_sys( + LIB_ERR_SOCKET, + "Network: setsockopt (%d) on ifindex %d failed: %s", + option, ifindex, safe_strerror(errno)); return ret; } diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c index 15d8eb6cf2..a099eead49 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -574,8 +574,8 @@ static void route_table_assert(struct ospf6_route_table *table) if (link_error == 0 && num == table->count) return; - zlog_err("PANIC !!"); - zlog_err("Something has gone wrong with ospf6_route_table[%p]", table); + flog_err(LIB_ERR_DEVELOPMENT, "PANIC !!"); + flog_err(LIB_ERR_DEVELOPMENT, "Something has gone wrong with ospf6_route_table[%p]", table); zlog_debug("table count = %d, real number = %d", table->count, num); zlog_debug("DUMP START"); for (r = ospf6_route_head(table); r; r = ospf6_route_next(r)) { diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index 5b6691e6bf..9c13c51b1f 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -30,6 +30,7 @@ #include "pqueue.h" #include "linklist.h" #include "thread.h" +#include "lib_errors.h" #include "ospf6_lsa.h" #include "ospf6_lsdb.h" @@ -272,7 +273,8 @@ static void ospf6_nexthop_calc(struct ospf6_vertex *w, struct ospf6_vertex *v, ifindex = (VERTEX_IS_TYPE(NETWORK, v) ? ospf6_spf_get_ifindex_from_nh(v) : ROUTER_LSDESC_GET_IFID(lsdesc)); if (ifindex == 0) { - zlog_err("No nexthop ifindex at vertex %s", v->name); + flog_err(LIB_ERR_DEVELOPMENT, + "No nexthop ifindex at vertex %s", v->name); return; } @@ -1012,16 +1014,10 @@ struct ospf6_lsa *ospf6_create_single_router_lsa(struct ospf6_area *area, /* Allocate memory for this LSA */ new_header = XMALLOC(MTYPE_OSPF6_LSA_HEADER, total_lsa_length); - if (!new_header) - return NULL; /* LSA information structure */ lsa = (struct ospf6_lsa *)XCALLOC(MTYPE_OSPF6_LSA, sizeof(struct ospf6_lsa)); - if (!lsa) { - free(new_header); - return NULL; - } lsa->header = (struct ospf6_lsa_header *)new_header; diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index 8458d19952..06a84dcb93 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -28,6 +28,7 @@ #include "zclient.h" #include "memory.h" #include "lib/bfd.h" +#include "lib_errors.h" #include "ospf6_proto.h" #include "ospf6_top.h" @@ -362,9 +363,10 @@ static void ospf6_zebra_route_update(int type, struct ospf6_route *request) ret = zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api); if (ret < 0) - zlog_err("zclient_route_send() %s failed: %s", - (type == REM ? "delete" : "add"), - safe_strerror(errno)); + flog_err(LIB_ERR_ZAPI_SOCKET, + "zclient_route_send() %s failed: %s", + (type == REM ? "delete" : "add"), + safe_strerror(errno)); return; } |
