diff options
author | David Lamparter <equinox@diac24.net> | 2016-11-13 04:19:14 +0100 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2017-03-08 00:15:39 +0100 |
commit | 4525281af19b5800ffce4bda83e0957d21ccad43 (patch) | |
tree | 8919c479f14116f3cae9fc5b051673e2f796371d | |
parent | *: add frr_run() (diff) | |
download | frr-4525281af19b5800ffce4bda83e0957d21ccad43.tar.xz frr-4525281af19b5800ffce4bda83e0957d21ccad43.zip |
*: get rid of zlog(*, LOG_LEVEL, ...)
Result of running the following Coccinelle patch + fixups:
<<EOF
/* long-forms: zlog(NULL, <level>, ...)
* => zlog_level(...)
*/
@@
expression list args;
@@
- zlog(NULL, LOG_DEBUG, args)
+ zlog_debug(args)
@@
expression list args;
@@
- zlog(NULL, LOG_NOTICE, args)
+ zlog_notice(args)
@@
expression list args;
@@
- zlog(NULL, LOG_INFO, args)
+ zlog_info(args)
@@
expression list args;
@@
- zlog(NULL, LOG_WARNING, args)
+ zlog_warn(args)
@@
expression list args;
@@
- zlog(NULL, LOG_ERR, args)
+ zlog_err(args)
/* long-forms: zlog(base->log, <level>, ...)
* => zlog_level(...)
*/
@@
expression base;
expression list args;
@@
- zlog(base->log, LOG_DEBUG, args)
+ zlog_debug(args)
@@
expression base;
expression list args;
@@
- zlog(base->log, LOG_NOTICE, args)
+ zlog_notice(args)
@@
expression base;
expression list args;
@@
- zlog(base->log, LOG_INFO, args)
+ zlog_info(args)
@@
expression base;
expression list args;
@@
- zlog(base->log, LOG_WARNING, args)
+ zlog_warn(args)
@@
expression base;
expression list args;
@@
- zlog(base->log, LOG_ERR, args)
+ zlog_err(args)
EOF
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
-rw-r--r-- | lib/if.c | 4 | ||||
-rw-r--r-- | lib/prefix.c | 3 | ||||
-rw-r--r-- | lib/routemap.c | 5 | ||||
-rw-r--r-- | lib/sockunion.c | 37 | ||||
-rw-r--r-- | lib/thread.c | 3 | ||||
-rw-r--r-- | lib/vty.c | 20 | ||||
-rw-r--r-- | ospfd/ospf_ism.c | 20 | ||||
-rw-r--r-- | ospfd/ospf_main.c | 2 | ||||
-rw-r--r-- | ospfd/ospf_nsm.c | 8 | ||||
-rw-r--r-- | ospfd/ospf_packet.c | 13 | ||||
-rw-r--r-- | ospfd/ospf_snmp.c | 14 | ||||
-rw-r--r-- | ospfd/ospf_vty.c | 2 | ||||
-rw-r--r-- | ripd/rip_interface.c | 5 | ||||
-rw-r--r-- | ripngd/ripngd.c | 7 | ||||
-rw-r--r-- | zebra/if_ioctl_solaris.c | 12 | ||||
-rw-r--r-- | zebra/if_sysctl.c | 6 | ||||
-rw-r--r-- | zebra/ioctl.c | 14 | ||||
-rw-r--r-- | zebra/ioctl_solaris.c | 12 | ||||
-rw-r--r-- | zebra/ipforward_sysctl.c | 30 | ||||
-rw-r--r-- | zebra/kernel_netlink.c | 68 | ||||
-rw-r--r-- | zebra/kernel_socket.c | 7 | ||||
-rw-r--r-- | zebra/rt_socket.c | 6 | ||||
-rw-r--r-- | zebra/zserv.c | 4 |
23 files changed, 142 insertions, 160 deletions
@@ -987,7 +987,7 @@ connected_log (struct connected *connected, char *str) strncat (logbuf, inet_ntop (p->family, &p->u.prefix, buf, BUFSIZ), BUFSIZ - strlen(logbuf)); } - zlog (NULL, LOG_INFO, "%s", logbuf); + zlog_info("%s", logbuf); } /* Print if_addr structure. */ @@ -1007,7 +1007,7 @@ nbr_connected_log (struct nbr_connected *connected, char *str) inet_ntop (p->family, &p->u.prefix, buf, BUFSIZ), p->prefixlen); - zlog (NULL, LOG_INFO, "%s", logbuf); + zlog_info("%s", logbuf); } /* If two connected address has same prefix return 1. */ diff --git a/lib/prefix.c b/lib/prefix.c index dec22a44a..0cc759bb7 100644 --- a/lib/prefix.c +++ b/lib/prefix.c @@ -313,8 +313,7 @@ prefix_copy (struct prefix *dest, const struct prefix *src) } else { - zlog (NULL, LOG_ERR, "prefix_copy(): Unknown address family %d", - src->family); + zlog_err("prefix_copy(): Unknown address family %d", src->family); assert (0); } } diff --git a/lib/routemap.c b/lib/routemap.c index 39d9a5d37..78d428524 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -1614,9 +1614,8 @@ route_map_apply (struct route_map *map, struct prefix *prefix, if (recursion > RMAP_RECURSION_LIMIT) { - zlog (NULL, LOG_WARNING, - "route-map recursion limit (%d) reached, discarding route", - RMAP_RECURSION_LIMIT); + zlog_warn("route-map recursion limit (%d) reached, discarding route", + RMAP_RECURSION_LIMIT); recursion = 0; return RMAP_DENYMATCH; } diff --git a/lib/sockunion.c b/lib/sockunion.c index 5b508d1bf..9ba2ce82f 100644 --- a/lib/sockunion.c +++ b/lib/sockunion.c @@ -148,8 +148,8 @@ sockunion_socket (const union sockunion *su) if (sock < 0) { char buf[SU_ADDRSTRLEN]; - zlog (NULL, LOG_WARNING, "Can't make socket for %s : %s", - sockunion_log (su, buf, SU_ADDRSTRLEN), safe_strerror (errno)); + zlog_warn("Can't make socket for %s : %s", + sockunion_log(su, buf, SU_ADDRSTRLEN), safe_strerror(errno)); return -1; } @@ -264,7 +264,7 @@ sockunion_stream_socket (union sockunion *su) sock = socket (su->sa.sa_family, SOCK_STREAM, 0); if (sock < 0) - zlog (NULL, LOG_WARNING, "can't make socket sockunion_stream_socket"); + zlog_warn("can't make socket sockunion_stream_socket"); return sock; } @@ -308,8 +308,8 @@ sockunion_bind (int sock, union sockunion *su, unsigned short port, if (ret < 0) { char buf[SU_ADDRSTRLEN]; - zlog (NULL, LOG_WARNING, "can't bind socket for %s : %s", - sockunion_log (su, buf, SU_ADDRSTRLEN), safe_strerror (errno)); + zlog_warn("can't bind socket for %s : %s", + sockunion_log(su, buf, SU_ADDRSTRLEN), safe_strerror(errno)); } return ret; @@ -325,7 +325,7 @@ sockopt_reuseaddr (int sock) (void *) &on, sizeof (on)); if (ret < 0) { - zlog (NULL, LOG_WARNING, "can't set sockopt SO_REUSEADDR to socket %d", sock); + zlog_warn("can't set sockopt SO_REUSEADDR to socket %d", sock); return -1; } return 0; @@ -342,7 +342,7 @@ sockopt_reuseport (int sock) (void *) &on, sizeof (on)); if (ret < 0) { - zlog (NULL, LOG_WARNING, "can't set sockopt SO_REUSEPORT to socket %d", sock); + zlog_warn("can't set sockopt SO_REUSEPORT to socket %d", sock); return -1; } return 0; @@ -367,7 +367,7 @@ sockopt_ttl (int family, int sock, int ttl) (void *) &ttl, sizeof (int)); if (ret < 0) { - zlog (NULL, LOG_WARNING, "can't set sockopt IP_TTL %d to socket %d", ttl, sock); + zlog_warn("can't set sockopt IP_TTL %d to socket %d", ttl, sock); return -1; } return 0; @@ -379,8 +379,8 @@ sockopt_ttl (int family, int sock, int ttl) (void *) &ttl, sizeof (int)); if (ret < 0) { - zlog (NULL, LOG_WARNING, "can't set sockopt IPV6_UNICAST_HOPS %d to socket %d", - ttl, sock); + zlog_warn("can't set sockopt IPV6_UNICAST_HOPS %d to socket %d", + ttl, sock); return -1; } return 0; @@ -425,9 +425,8 @@ sockopt_minttl (int family, int sock, int minttl) { int ret = setsockopt (sock, IPPROTO_IP, IP_MINTTL, &minttl, sizeof(minttl)); if (ret < 0) - zlog (NULL, LOG_WARNING, - "can't set sockopt IP_MINTTL to %d on socket %d: %s", - minttl, sock, safe_strerror (errno)); + zlog_warn("can't set sockopt IP_MINTTL to %d on socket %d: %s", + minttl, sock, safe_strerror(errno)); return ret; } #endif /* IP_MINTTL */ @@ -436,9 +435,8 @@ sockopt_minttl (int family, int sock, int minttl) { int ret = setsockopt (sock, IPPROTO_IPV6, IPV6_MINHOPCOUNT, &minttl, sizeof(minttl)); if (ret < 0) - zlog (NULL, LOG_WARNING, - "can't set sockopt IPV6_MINHOPCOUNT to %d on socket %d: %s", - minttl, sock, safe_strerror (errno)); + zlog_warn("can't set sockopt IPV6_MINHOPCOUNT to %d on socket %d: %s", + minttl, sock, safe_strerror(errno)); return ret; } #endif @@ -459,8 +457,8 @@ sockopt_v6only (int family, int sock) (void *) &on, sizeof (int)); if (ret < 0) { - zlog (NULL, LOG_WARNING, "can't set sockopt IPV6_V6ONLY " - "to socket %d", sock); + zlog_warn("can't set sockopt IPV6_V6ONLY " "to socket %d", + sock); return -1; } return 0; @@ -626,8 +624,7 @@ sockunion_getpeername (int fd) ret = getpeername (fd, (struct sockaddr *)&name, &len); if (ret < 0) { - zlog (NULL, LOG_WARNING, "Can't get remote address and port: %s", - safe_strerror (errno)); + zlog_warn("Can't get remote address and port: %s", safe_strerror(errno)); return NULL; } diff --git a/lib/thread.c b/lib/thread.c index c1558a83e..6138e7971 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -719,7 +719,8 @@ funcname_thread_add_read_write (int dir, struct thread_master *m, #else if (FD_ISSET (fd, fdset)) { - zlog (NULL, LOG_WARNING, "There is already %s fd [%d]", (dir == THREAD_READ) ? "read" : "write", fd); + zlog_warn ("There is already %s fd [%d]", + (dir == THREAD_READ) ? "read" : "write", fd); return NULL; } @@ -214,7 +214,7 @@ vty_time_print (struct vty *vty, int cr) if (quagga_timestamp(0, buf, sizeof(buf)) == 0) { - zlog (NULL, LOG_INFO, "quagga_timestamp error"); + zlog_info("quagga_timestamp error"); return; } if (cr) @@ -437,7 +437,7 @@ vty_command (struct vty *vty, char *buf) snprintf(prompt_str, sizeof(prompt_str), cmd_prompt (vty->node), vty_str); /* now log the command */ - zlog(NULL, LOG_ERR, "%s%s", prompt_str, buf); + zlog_err("%s%s", prompt_str, buf); } /* Split readline string up into the vector */ vline = cmd_make_strvec (buf); @@ -1856,8 +1856,8 @@ vty_accept (struct thread *thread) if ((acl = access_list_lookup (AFI_IP, vty_accesslist_name)) && (access_list_apply (acl, &p) == FILTER_DENY)) { - zlog (NULL, LOG_INFO, "Vty connection refused from %s", - sockunion2str (&su, buf, SU_ADDRSTRLEN)); + zlog_info ("Vty connection refused from %s", + sockunion2str (&su, buf, SU_ADDRSTRLEN)); close (vty_sock); /* continue accepting connections */ @@ -1873,8 +1873,8 @@ vty_accept (struct thread *thread) if ((acl = access_list_lookup (AFI_IP6, vty_ipv6_accesslist_name)) && (access_list_apply (acl, &p) == FILTER_DENY)) { - zlog (NULL, LOG_INFO, "Vty connection refused from %s", - sockunion2str (&su, buf, SU_ADDRSTRLEN)); + zlog_info ("Vty connection refused from %s", + sockunion2str (&su, buf, SU_ADDRSTRLEN)); close (vty_sock); /* continue accepting connections */ @@ -1888,11 +1888,11 @@ vty_accept (struct thread *thread) ret = setsockopt (vty_sock, IPPROTO_TCP, TCP_NODELAY, (char *) &on, sizeof (on)); if (ret < 0) - zlog (NULL, LOG_INFO, "can't set sockopt to vty_sock : %s", - safe_strerror (errno)); + zlog_info ("can't set sockopt to vty_sock : %s", + safe_strerror (errno)); - zlog (NULL, LOG_INFO, "Vty connection from %s", - sockunion2str (&su, buf, SU_ADDRSTRLEN)); + zlog_info ("Vty connection from %s", + sockunion2str (&su, buf, SU_ADDRSTRLEN)); vty_create (vty_sock, &su); diff --git a/ospfd/ospf_ism.c b/ospfd/ospf_ism.c index ae6d0cdbc..9630616ac 100644 --- a/ospfd/ospf_ism.c +++ b/ospfd/ospf_ism.c @@ -255,8 +255,7 @@ ospf_hello_timer (struct thread *thread) oi->t_hello = NULL; if (IS_DEBUG_OSPF (ism, ISM_TIMERS)) - zlog (NULL, LOG_DEBUG, "ISM[%s]: Timer (Hello timer expire)", - IF_NAME (oi)); + zlog_debug("ISM[%s]: Timer (Hello timer expire)", IF_NAME(oi)); /* Sending hello packet. */ ospf_hello_send (oi); @@ -276,8 +275,7 @@ ospf_wait_timer (struct thread *thread) oi->t_wait = NULL; if (IS_DEBUG_OSPF (ism, ISM_TIMERS)) - zlog (NULL, LOG_DEBUG, "ISM[%s]: Timer (Wait timer expire)", - IF_NAME (oi)); + zlog_debug("ISM[%s]: Timer (Wait timer expire)", IF_NAME(oi)); OSPF_ISM_EVENT_SCHEDULE (oi, ISM_WaitTimer); @@ -418,7 +416,7 @@ static int ism_ignore (struct ospf_interface *oi) { if (IS_DEBUG_OSPF (ism, ISM_EVENTS)) - zlog (NULL, LOG_DEBUG, "ISM[%s]: ism_ignore called", IF_NAME (oi)); + zlog_debug("ISM[%s]: ism_ignore called", IF_NAME(oi)); return 0; } @@ -539,9 +537,9 @@ ism_change_state (struct ospf_interface *oi, int state) /* Logging change of state. */ if (IS_DEBUG_OSPF (ism, ISM_STATUS)) - zlog (NULL, LOG_DEBUG, "ISM[%s]: State change %s -> %s", IF_NAME (oi), - LOOKUP (ospf_ism_state_msg, oi->state), - LOOKUP (ospf_ism_state_msg, state)); + zlog_debug("ISM[%s]: State change %s -> %s", IF_NAME(oi), + LOOKUP(ospf_ism_state_msg, oi->state), + LOOKUP(ospf_ism_state_msg, state)); old_state = oi->state; oi->state = state; @@ -617,9 +615,9 @@ ospf_ism_event (struct thread *thread) next_state = ISM [oi->state][event].next_state; if (IS_DEBUG_OSPF (ism, ISM_EVENTS)) - zlog (NULL, LOG_DEBUG, "ISM[%s]: %s (%s)", IF_NAME (oi), - LOOKUP (ospf_ism_state_msg, oi->state), - ospf_ism_event_str[event]); + zlog_debug("ISM[%s]: %s (%s)", IF_NAME(oi), + LOOKUP(ospf_ism_state_msg, oi->state), + ospf_ism_event_str[event]); /* If state is changed. */ if (next_state != oi->state) diff --git a/ospfd/ospf_main.c b/ospfd/ospf_main.c index 47aa6c63e..022bb2669 100644 --- a/ospfd/ospf_main.c +++ b/ospfd/ospf_main.c @@ -112,7 +112,7 @@ Report bugs to %s\n", progname, FRR_BUG_ADDRESS); static void sighup (void) { - zlog (NULL, LOG_INFO, "SIGHUP received"); + zlog_info("SIGHUP received"); } /* SIGINT / SIGTERM handler. */ diff --git a/ospfd/ospf_nsm.c b/ospfd/ospf_nsm.c index ccb82bf8f..01617055c 100644 --- a/ospfd/ospf_nsm.c +++ b/ospfd/ospf_nsm.c @@ -63,8 +63,8 @@ ospf_inactivity_timer (struct thread *thread) nbr->t_inactivity = NULL; if (IS_DEBUG_OSPF (nsm, NSM_TIMERS)) - zlog (NULL, LOG_DEBUG, "NSM[%s:%s]: Timer (Inactivity timer expire)", - IF_NAME (nbr->oi), inet_ntoa (nbr->router_id)); + zlog_debug("NSM[%s:%s]: Timer (Inactivity timer expire)", + IF_NAME(nbr->oi), inet_ntoa(nbr->router_id)); OSPF_NSM_EVENT_SCHEDULE (nbr, NSM_InactivityTimer); @@ -80,8 +80,8 @@ ospf_db_desc_timer (struct thread *thread) nbr->t_db_desc = NULL; if (IS_DEBUG_OSPF (nsm, NSM_TIMERS)) - zlog (NULL, LOG_DEBUG, "NSM[%s:%s]: Timer (DD Retransmit timer expire)", - IF_NAME (nbr->oi), inet_ntoa (nbr->src)); + zlog_debug("NSM[%s:%s]: Timer (DD Retransmit timer expire)", + IF_NAME(nbr->oi), inet_ntoa(nbr->src)); /* resent last send DD packet. */ assert (nbr->last_send); diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c index bf78336ad..a0cc367cd 100644 --- a/ospfd/ospf_packet.c +++ b/ospfd/ospf_packet.c @@ -2971,9 +2971,8 @@ ospf_read (struct thread *thread) ospf_ls_ack (iph, ospfh, ibuf, oi, length); break; default: - zlog (NULL, LOG_WARNING, - "interface %s: OSPF packet header type %d is illegal", - IF_NAME (oi), ospfh->type); + zlog_warn("interface %s: OSPF packet header type %d is illegal", + IF_NAME(oi), ospfh->type); break; } @@ -3453,8 +3452,8 @@ ospf_poll_timer (struct thread *thread) nbr_nbma->t_poll = NULL; if (IS_DEBUG_OSPF (nsm, NSM_TIMERS)) - zlog (NULL, LOG_DEBUG, "NSM[%s:%s]: Timer (Poll timer expire)", - IF_NAME (nbr_nbma->oi), inet_ntoa (nbr_nbma->addr)); + zlog_debug("NSM[%s:%s]: Timer (Poll timer expire)", IF_NAME(nbr_nbma->oi), + inet_ntoa(nbr_nbma->addr)); ospf_poll_send (nbr_nbma); @@ -3477,8 +3476,8 @@ ospf_hello_reply_timer (struct thread *thread) assert (nbr->oi); if (IS_DEBUG_OSPF (nsm, NSM_TIMERS)) - zlog (NULL, LOG_DEBUG, "NSM[%s:%s]: Timer (hello-reply timer expire)", - IF_NAME (nbr->oi), inet_ntoa (nbr->router_id)); + zlog_debug("NSM[%s:%s]: Timer (hello-reply timer expire)", + IF_NAME(nbr->oi), inet_ntoa(nbr->router_id)); ospf_hello_send_sub (nbr->oi, nbr->address.u.prefix4.s_addr); diff --git a/ospfd/ospf_snmp.c b/ospfd/ospf_snmp.c index 676756d6d..4afbda878 100644 --- a/ospfd/ospf_snmp.c +++ b/ospfd/ospf_snmp.c @@ -2658,8 +2658,8 @@ ospfTrapNbrStateChange (struct ospf_neighbor *on) char msgbuf[16]; ospf_nbr_state_message(on, msgbuf, sizeof(msgbuf)); - zlog (NULL, LOG_INFO, "ospfTrapNbrStateChange trap sent: %s now %s", - inet_ntoa(on->address.u.prefix4), msgbuf); + zlog_info("ospfTrapNbrStateChange trap sent: %s now %s", + inet_ntoa(on->address.u.prefix4), msgbuf); oid_copy_addr (index, &(on->address.u.prefix4), IN_ADDR_SIZE); index[IN_ADDR_SIZE] = 0; @@ -2678,7 +2678,7 @@ ospfTrapVirtNbrStateChange (struct ospf_neighbor *on) { oid index[sizeof (oid) * (IN_ADDR_SIZE + 1)]; - zlog (NULL, LOG_INFO, "ospfTrapVirtNbrStateChange trap sent"); + zlog_info("ospfTrapVirtNbrStateChange trap sent"); oid_copy_addr (index, &(on->address.u.prefix4), IN_ADDR_SIZE); index[IN_ADDR_SIZE] = 0; @@ -2697,9 +2697,9 @@ ospfTrapIfStateChange (struct ospf_interface *oi) { oid index[sizeof (oid) * (IN_ADDR_SIZE + 1)]; - zlog (NULL, LOG_INFO, "ospfTrapIfStateChange trap sent: %s now %s", - inet_ntoa(oi->address->u.prefix4), - LOOKUP(ospf_ism_state_msg, oi->state)); + zlog_info("ospfTrapIfStateChange trap sent: %s now %s", + inet_ntoa(oi->address->u.prefix4), + LOOKUP(ospf_ism_state_msg, oi->state)); oid_copy_addr (index, &(oi->address->u.prefix4), IN_ADDR_SIZE); index[IN_ADDR_SIZE] = 0; @@ -2718,7 +2718,7 @@ ospfTrapVirtIfStateChange (struct ospf_interface *oi) { oid index[sizeof (oid) * (IN_ADDR_SIZE + 1)]; - zlog (NULL, LOG_INFO, "ospfTrapVirtIfStateChange trap sent"); + zlog_info("ospfTrapVirtIfStateChange trap sent"); oid_copy_addr (index, &(oi->address->u.prefix4), IN_ADDR_SIZE); index[IN_ADDR_SIZE] = 0; diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 62498f4c8..ce4bc9dfa 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -9117,7 +9117,7 @@ ospf_interface_clear (struct interface *ifp) if (!if_is_operative (ifp)) return; if (IS_DEBUG_OSPF (ism, ISM_EVENTS)) - zlog (NULL, LOG_DEBUG, "ISM[%s]: clear by reset", ifp->name); + zlog_debug("ISM[%s]: clear by reset", ifp->name); ospf_if_reset(ifp); } diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index 772ba49f9..4c750faf4 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -86,8 +86,7 @@ ipv4_multicast_join (int sock, ifindex); if (ret < 0) - zlog (NULL, LOG_INFO, "can't setsockopt IP_ADD_MEMBERSHIP %s", - safe_strerror (errno)); + zlog_info("can't setsockopt IP_ADD_MEMBERSHIP %s", safe_strerror(errno)); return ret; } @@ -108,7 +107,7 @@ ipv4_multicast_leave (int sock, ifindex); if (ret < 0) - zlog (NULL, LOG_INFO, "can't setsockopt IP_DROP_MEMBERSHIP"); + zlog_info("can't setsockopt IP_DROP_MEMBERSHIP"); return ret; } diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index b4f82575a..108da21c1 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -107,7 +107,7 @@ ripng_make_socket (void) sock = socket (AF_INET6, SOCK_DGRAM, 0); if (sock < 0) { - zlog (NULL, LOG_ERR, "Can't make ripng socket"); + zlog_err("Can't make ripng socket"); return sock; } @@ -143,7 +143,7 @@ ripng_make_socket (void) ret = bind (sock, (struct sockaddr *) &ripaddr, sizeof (ripaddr)); if (ret < 0) { - zlog (NULL, LOG_ERR, "Can't bind ripng socket: %s.", safe_strerror (errno)); + zlog_err("Can't bind ripng socket: %s.", safe_strerror(errno)); if (ripngd_privs.change (ZPRIVS_LOWER)) zlog_err ("ripng_make_socket: could not lower privs"); return ret; @@ -1448,8 +1448,7 @@ ripng_update (struct thread *t) if (ri->ri_send == RIPNG_SEND_OFF) { if (IS_RIPNG_DEBUG_EVENT) - zlog (NULL, LOG_DEBUG, - "[Event] RIPng send to if %d is suppressed by config", + zlog_debug ("[Event] RIPng send to if %d is suppressed by config", ifp->ifindex); continue; } diff --git a/zebra/if_ioctl_solaris.c b/zebra/if_ioctl_solaris.c index f27dc8900..339e00b22 100644 --- a/zebra/if_ioctl_solaris.c +++ b/zebra/if_ioctl_solaris.c @@ -59,7 +59,7 @@ interface_list_ioctl (int af) char *buf = NULL; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog (NULL, LOG_ERR, "Can't raise privileges"); + zlog_err("Can't raise privileges"); sock = socket (af, SOCK_DGRAM, 0); if (sock < 0) @@ -68,7 +68,7 @@ interface_list_ioctl (int af) (af == AF_INET ? "AF_INET" : "AF_INET6"), safe_strerror (errno)); if (zserv_privs.change(ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); return -1; } @@ -80,7 +80,7 @@ calculate_lifc_len: /* must hold privileges to enter here */ save_errno = errno; if (zserv_privs.change(ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); if (ret < 0) { @@ -117,7 +117,7 @@ calculate_lifc_len: /* must hold privileges to enter here */ lifconf.lifc_buf = buf; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog (NULL, LOG_ERR, "Can't raise privileges"); + zlog_err("Can't raise privileges"); ret = ioctl (sock, SIOCGLIFCONF, &lifconf); @@ -129,13 +129,13 @@ calculate_lifc_len: /* must hold privileges to enter here */ zlog_warn ("SIOCGLIFCONF: %s", safe_strerror (errno)); if (zserv_privs.change(ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); goto end; } if (zserv_privs.change(ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); /* Allocate interface. */ lifreq = lifconf.lifc_req; diff --git a/zebra/if_sysctl.c b/zebra/if_sysctl.c index 0b71c7621..8326f0e39 100644 --- a/zebra/if_sysctl.c +++ b/zebra/if_sysctl.c @@ -69,7 +69,7 @@ ifstat_update_sysctl (void) /* Fetch interface informations into allocated buffer. */ if (sysctl (mib, MIBSIZ, buf, &bufsiz, NULL, 0) < 0) { - zlog (NULL, LOG_WARNING, "sysctl error by %s", safe_strerror (errno)); + zlog_warn("sysctl error by %s", safe_strerror(errno)); XFREE(MTYPE_TMP, ref); return; } @@ -120,7 +120,7 @@ interface_list (struct zebra_ns *zns) /* Query buffer size. */ if (sysctl (mib, MIBSIZ, NULL, &bufsiz, NULL, 0) < 0) { - zlog (NULL, LOG_WARNING, "sysctl() error by %s", safe_strerror (errno)); + zlog_warn("sysctl() error by %s", safe_strerror(errno)); return; } @@ -130,7 +130,7 @@ interface_list (struct zebra_ns *zns) /* Fetch interface informations into allocated buffer. */ if (sysctl (mib, MIBSIZ, buf, &bufsiz, NULL, 0) < 0) { - zlog (NULL, LOG_WARNING, "sysctl error by %s", safe_strerror (errno)); + zlog_warn("sysctl error by %s", safe_strerror(errno)); return; } diff --git a/zebra/ioctl.c b/zebra/ioctl.c index 112504331..dfd69300f 100644 --- a/zebra/ioctl.c +++ b/zebra/ioctl.c @@ -56,20 +56,20 @@ if_ioctl (u_long request, caddr_t buffer) int err = 0; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog (NULL, LOG_ERR, "Can't raise privileges"); + zlog_err("Can't raise privileges"); sock = socket (AF_INET, SOCK_DGRAM, 0); if (sock < 0) { int save_errno = errno; if (zserv_privs.change(ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); zlog_err("Cannot create UDP socket: %s", safe_strerror(save_errno)); exit (1); } if ((ret = ioctl (sock, request, buffer)) < 0) err = errno; if (zserv_privs.change(ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); close (sock); if (ret < 0) @@ -88,13 +88,13 @@ if_ioctl_ipv6 (u_long request, caddr_t buffer) int err = 0; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog (NULL, LOG_ERR, "Can't raise privileges"); + zlog_err("Can't raise privileges"); sock = socket (AF_INET6, SOCK_DGRAM, 0); if (sock < 0) { int save_errno = errno; if (zserv_privs.change(ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); zlog_err("Cannot create IPv6 datagram socket: %s", safe_strerror(save_errno)); exit (1); @@ -103,7 +103,7 @@ if_ioctl_ipv6 (u_long request, caddr_t buffer) if ((ret = ioctl (sock, request, buffer)) < 0) err = errno; if (zserv_privs.change(ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); close (sock); if (ret < 0) @@ -162,7 +162,7 @@ if_get_mtu (struct interface *ifp) zebra_interface_up_update(ifp); #else - zlog (NULL, LOG_INFO, "Can't lookup mtu on this system"); + zlog_info("Can't lookup mtu on this system"); ifp->mtu6 = ifp->mtu = -1; #endif } diff --git a/zebra/ioctl_solaris.c b/zebra/ioctl_solaris.c index 1de583577..78796a8a2 100644 --- a/zebra/ioctl_solaris.c +++ b/zebra/ioctl_solaris.c @@ -53,14 +53,14 @@ if_ioctl (u_long request, caddr_t buffer) int err; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog (NULL, LOG_ERR, "Can't raise privileges"); + zlog_err("Can't raise privileges"); sock = socket (AF_INET, SOCK_DGRAM, 0); if (sock < 0) { int save_errno = errno; if (zserv_privs.change(ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); zlog_err("Cannot create UDP socket: %s", safe_strerror(save_errno)); exit (1); } @@ -69,7 +69,7 @@ if_ioctl (u_long request, caddr_t buffer) err = errno; if (zserv_privs.change(ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); close (sock); @@ -90,14 +90,14 @@ if_ioctl_ipv6 (u_long request, caddr_t buffer) int err; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog (NULL, LOG_ERR, "Can't raise privileges"); + zlog_err("Can't raise privileges"); sock = socket (AF_INET6, SOCK_DGRAM, 0); if (sock < 0) { int save_errno = errno; if (zserv_privs.change(ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); zlog_err("Cannot create IPv6 datagram socket: %s", safe_strerror(save_errno)); exit (1); @@ -107,7 +107,7 @@ if_ioctl_ipv6 (u_long request, caddr_t buffer) err = errno; if (zserv_privs.change(ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); close (sock); diff --git a/zebra/ipforward_sysctl.c b/zebra/ipforward_sysctl.c index be4c9cd99..28894f4e0 100644 --- a/zebra/ipforward_sysctl.c +++ b/zebra/ipforward_sysctl.c @@ -61,16 +61,16 @@ ipforward_on (void) len = sizeof ipforwarding; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog (NULL, LOG_ERR, "Can't raise privileges"); + zlog_err("Can't raise privileges"); if (sysctl (mib, MIB_SIZ, NULL, NULL, &ipforwarding, len) < 0) { if (zserv_privs.change(ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); zlog_warn ("Can't set ipforwarding on"); return -1; } if (zserv_privs.change(ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); return ipforwarding; } @@ -82,16 +82,16 @@ ipforward_off (void) len = sizeof ipforwarding; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog (NULL, LOG_ERR, "Can't raise privileges"); + zlog_err("Can't raise privileges"); if (sysctl (mib, MIB_SIZ, NULL, NULL, &ipforwarding, len) < 0) { if (zserv_privs.change(ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); zlog_warn ("Can't set ipforwarding on"); return -1; } if (zserv_privs.change(ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); return ipforwarding; } @@ -117,16 +117,16 @@ ipforward_ipv6 (void) len = sizeof ip6forwarding; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog (NULL, LOG_ERR, "Can't raise privileges"); + zlog_err("Can't raise privileges"); if (sysctl (mib_ipv6, MIB_SIZ, &ip6forwarding, &len, 0, 0) < 0) { if (zserv_privs.change(ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); zlog_warn ("can't get ip6forwarding value"); return -1; } if (zserv_privs.change(ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); return ip6forwarding; } @@ -138,16 +138,16 @@ ipforward_ipv6_on (void) len = sizeof ip6forwarding; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog (NULL, LOG_ERR, "Can't raise privileges"); + zlog_err("Can't raise privileges"); if (sysctl (mib_ipv6, MIB_SIZ, NULL, NULL, &ip6forwarding, len) < 0) { if (zserv_privs.change(ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); zlog_warn ("can't get ip6forwarding value"); return -1; } if (zserv_privs.change(ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); return ip6forwarding; } @@ -159,15 +159,15 @@ ipforward_ipv6_off (void) len = sizeof ip6forwarding; if (zserv_privs.change(ZPRIVS_RAISE)) - zlog (NULL, LOG_ERR, "Can't raise privileges"); + zlog_err("Can't raise privileges"); if (sysctl (mib_ipv6, MIB_SIZ, NULL, NULL, &ip6forwarding, len) < 0) { if (zserv_privs.change(ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); zlog_warn ("can't get ip6forwarding value"); return -1; } if (zserv_privs.change(ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); return ip6forwarding; } diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c index c9c2d90ea..49394bd6f 100644 --- a/zebra/kernel_netlink.c +++ b/zebra/kernel_netlink.c @@ -143,8 +143,8 @@ netlink_recvbuf (struct nlsock *nl, uint32_t newsize) ret = getsockopt(nl->sock, SOL_SOCKET, SO_RCVBUF, &oldsize, &oldlen); if (ret < 0) { - zlog (NULL, LOG_ERR, "Can't get %s receive buffer size: %s", nl->name, - safe_strerror (errno)); + zlog_err("Can't get %s receive buffer size: %s", nl->name, + safe_strerror(errno)); return -1; } @@ -160,22 +160,21 @@ netlink_recvbuf (struct nlsock *nl, uint32_t newsize) sizeof(nl_rcvbufsize)); if (ret < 0) { - zlog (NULL, LOG_ERR, "Can't set %s receive buffer size: %s", nl->name, - safe_strerror (errno)); + zlog_err("Can't set %s receive buffer size: %s", nl->name, + safe_strerror(errno)); return -1; } ret = getsockopt(nl->sock, SOL_SOCKET, SO_RCVBUF, &newsize, &newlen); if (ret < 0) { - zlog (NULL, LOG_ERR, "Can't get %s receive buffer size: %s", nl->name, - safe_strerror (errno)); + zlog_err("Can't get %s receive buffer size: %s", nl->name, + safe_strerror(errno)); return -1; } - zlog (NULL, LOG_INFO, - "Setting netlink socket receive buffer size: %u -> %u", - oldsize, newsize); + zlog_info("Setting netlink socket receive buffer size: %u -> %u", oldsize, + newsize); return 0; } @@ -191,15 +190,14 @@ netlink_socket (struct nlsock *nl, unsigned long groups, ns_id_t ns_id) if (zserv_privs.change (ZPRIVS_RAISE)) { - zlog (NULL, LOG_ERR, "Can't raise privileges"); + zlog_err("Can't raise privileges"); return -1; } sock = socket (AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sock < 0) { - zlog (NULL, LOG_ERR, "Can't open %s socket: %s", nl->name, - safe_strerror (errno)); + zlog_err("Can't open %s socket: %s", nl->name, safe_strerror(errno)); return -1; } @@ -211,12 +209,12 @@ netlink_socket (struct nlsock *nl, unsigned long groups, ns_id_t ns_id) ret = bind (sock, (struct sockaddr *) &snl, sizeof snl); save_errno = errno; if (zserv_privs.change (ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); if (ret < 0) { - zlog (NULL, LOG_ERR, "Can't bind %s socket to group 0x%x: %s", - nl->name, snl.nl_groups, safe_strerror (save_errno)); + zlog_err("Can't bind %s socket to group 0x%x: %s", nl->name, + snl.nl_groups, safe_strerror(save_errno)); close (sock); return -1; } @@ -226,8 +224,7 @@ netlink_socket (struct nlsock *nl, unsigned long groups, ns_id_t ns_id) ret = getsockname (sock, (struct sockaddr *) &snl, (socklen_t *) &namelen); if (ret < 0 || namelen != sizeof snl) { - zlog (NULL, LOG_ERR, "Can't get %s socket name: %s", nl->name, - safe_strerror (errno)); + zlog_err("Can't get %s socket name: %s", nl->name, safe_strerror(errno)); close (sock); return -1; } @@ -244,7 +241,7 @@ netlink_information_fetch (struct sockaddr_nl *snl, struct nlmsghdr *h, /* JF: Ignore messages that aren't from the kernel */ if ( snl->nl_pid != 0 ) { - zlog ( NULL, LOG_ERR, "Ignoring message from pid %u", snl->nl_pid ); + zlog_err("Ignoring message from pid %u", snl->nl_pid); return 0; } @@ -493,8 +490,7 @@ netlink_parse_info (int (*filter) (struct sockaddr_nl *, struct nlmsghdr *, continue; if (errno == EWOULDBLOCK || errno == EAGAIN) break; - zlog (NULL, LOG_ERR, "%s recvmsg overrun: %s", - nl->name, safe_strerror(errno)); + zlog_err("%s recvmsg overrun: %s", nl->name, safe_strerror(errno)); /* * In this case we are screwed. * There is no good way to @@ -506,14 +502,14 @@ netlink_parse_info (int (*filter) (struct sockaddr_nl *, struct nlmsghdr *, if (status == 0) { - zlog (NULL, LOG_ERR, "%s EOF", nl->name); + zlog_err("%s EOF", nl->name); return -1; } if (msg.msg_namelen != sizeof snl) { - zlog (NULL, LOG_ERR, "%s sender address length error: length %d", - nl->name, msg.msg_namelen); + zlog_err("%s sender address length error: length %d", nl->name, + msg.msg_namelen); return -1; } @@ -558,8 +554,7 @@ netlink_parse_info (int (*filter) (struct sockaddr_nl *, struct nlmsghdr *, if (h->nlmsg_len < NLMSG_LENGTH (sizeof (struct nlmsgerr))) { - zlog (NULL, LOG_ERR, "%s error: message truncated", - nl->name); + zlog_err("%s error: message truncated", nl->name); return -1; } @@ -627,7 +622,7 @@ netlink_parse_info (int (*filter) (struct sockaddr_nl *, struct nlmsghdr *, error = (*filter) (&snl, h, zns->ns_id, startup); if (error < 0) { - zlog (NULL, LOG_ERR, "%s filter function error", nl->name); + zlog_err("%s filter function error", nl->name); ret = error; } } @@ -635,13 +630,12 @@ netlink_parse_info (int (*filter) (struct sockaddr_nl *, struct nlmsghdr *, /* After error care. */ if (msg.msg_flags & MSG_TRUNC) { - zlog (NULL, LOG_ERR, "%s error: message truncated", nl->name); + zlog_err("%s error: message truncated", nl->name); continue; } if (status) { - zlog (NULL, LOG_ERR, "%s error: data remnant size %d", nl->name, - status); + zlog_err("%s error: data remnant size %d", nl->name, status); return -1; } } @@ -696,11 +690,11 @@ netlink_talk (int (*filter) (struct sockaddr_nl *, struct nlmsghdr *, /* Send message to netlink interface. */ if (zserv_privs.change (ZPRIVS_RAISE)) - zlog (NULL, LOG_ERR, "Can't raise privileges"); + zlog_err("Can't raise privileges"); status = sendmsg (nl->sock, &msg, 0); save_errno = errno; if (zserv_privs.change (ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND) { @@ -710,8 +704,7 @@ netlink_talk (int (*filter) (struct sockaddr_nl *, struct nlmsghdr *, if (status < 0) { - zlog (NULL, LOG_ERR, "netlink_talk sendmsg() error: %s", - safe_strerror (save_errno)); + zlog_err("netlink_talk sendmsg() error: %s", safe_strerror(save_errno)); return -1; } @@ -740,7 +733,7 @@ netlink_request (int family, int type, struct nlsock *nl) /* Check netlink socket. */ if (nl->sock < 0) { - zlog (NULL, LOG_ERR, "%s socket isn't active.", nl->name); + zlog_err("%s socket isn't active.", nl->name); return -1; } @@ -760,7 +753,7 @@ netlink_request (int family, int type, struct nlsock *nl) */ if (zserv_privs.change (ZPRIVS_RAISE)) { - zlog (NULL, LOG_ERR, "Can't raise privileges"); + zlog_err("Can't raise privileges"); return -1; } @@ -769,12 +762,11 @@ netlink_request (int family, int type, struct nlsock *nl) save_errno = errno; if (zserv_privs.change (ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); if (ret < 0) { - zlog (NULL, LOG_ERR, "%s sendto failed: %s", nl->name, - safe_strerror (save_errno)); + zlog_err("%s sendto failed: %s", nl->name, safe_strerror(save_errno)); return -1; } diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c index 20a047219..1bb85a31a 100644 --- a/zebra/kernel_socket.c +++ b/zebra/kernel_socket.c @@ -826,9 +826,8 @@ rtm_read_mesg (struct rt_msghdr *rtm, /* rt_msghdr version check. */ if (rtm->rtm_version != RTM_VERSION) - zlog (NULL, LOG_WARNING, - "Routing message version different %d should be %d." - "This may cause problem\n", rtm->rtm_version, RTM_VERSION); + zlog_warn("Routing message version different %d should be %d." "This may cause problem\n", + rtm->rtm_version, RTM_VERSION); /* Be sure structure is cleared */ memset (dest, 0, sizeof (union sockunion)); @@ -852,7 +851,7 @@ rtm_read_mesg (struct rt_msghdr *rtm, /* Assert read up to the end of pointer. */ if (pnt != end) - zlog (NULL, LOG_WARNING, "rtm_read() doesn't read all socket data."); + zlog_warn("rtm_read() doesn't read all socket data."); return rtm->rtm_flags; } diff --git a/zebra/rt_socket.c b/zebra/rt_socket.c index a4cc4eed0..de8cc69a8 100644 --- a/zebra/rt_socket.c +++ b/zebra/rt_socket.c @@ -398,12 +398,12 @@ kernel_route_rib (struct prefix *p, struct prefix *src_p, if (src_p && src_p->prefixlen) { - zlog (NULL, LOG_ERR, "route add: IPv6 sourcedest routes unsupported!"); + zlog_err ("route add: IPv6 sourcedest routes unsupported!"); return 1; } if (zserv_privs.change(ZPRIVS_RAISE)) - zlog (NULL, LOG_ERR, "Can't raise privileges"); + zlog_err("Can't raise privileges"); if (old) route |= kernel_rtm (RTM_DELETE, p, old); @@ -412,7 +412,7 @@ kernel_route_rib (struct prefix *p, struct prefix *src_p, route |= kernel_rtm (RTM_ADD, p, new); if (zserv_privs.change(ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); return route; } diff --git a/zebra/zserv.c b/zebra/zserv.c index 60364410a..064489acd 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -2169,7 +2169,7 @@ zebra_serv () sockopt_reuseport (accept_sock); if ( zserv_privs.change(ZPRIVS_RAISE) ) - zlog (NULL, LOG_ERR, "Can't raise privileges"); + zlog_err("Can't raise privileges"); ret = bind (accept_sock, (struct sockaddr *)&addr, sizeof (struct sockaddr_in)); @@ -2183,7 +2183,7 @@ zebra_serv () } if ( zserv_privs.change(ZPRIVS_LOWER) ) - zlog (NULL, LOG_ERR, "Can't lower privileges"); + zlog_err("Can't lower privileges"); ret = listen (accept_sock, 1); if (ret < 0) |