diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-01-22 20:34:57 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-01-22 20:34:57 +0000 |
commit | 2d2140d9f143a293a04df5f751a36fda35c993c4 (patch) | |
tree | 7030735ccdddfb699ade95c68e659df7848df61b | |
parent | c84df82899a1c70448d6b740531565ba632f0101 (diff) |
use log_warnx and log_info. reclassify a few messages in the process and fix
a few messages.
ok claudio@
-rw-r--r-- | usr.sbin/bgpd/bgpd.c | 43 | ||||
-rw-r--r-- | usr.sbin/bgpd/config.c | 4 | ||||
-rw-r--r-- | usr.sbin/bgpd/control.c | 12 | ||||
-rw-r--r-- | usr.sbin/bgpd/imsg.c | 12 | ||||
-rw-r--r-- | usr.sbin/bgpd/kroute.c | 44 | ||||
-rw-r--r-- | usr.sbin/bgpd/mrt.c | 54 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde.c | 21 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde_decide.c | 17 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde_rib.c | 8 | ||||
-rw-r--r-- | usr.sbin/bgpd/session.c | 24 |
10 files changed, 114 insertions, 125 deletions
diff --git a/usr.sbin/bgpd/bgpd.c b/usr.sbin/bgpd/bgpd.c index 513aff93196..39366472796 100644 --- a/usr.sbin/bgpd/bgpd.c +++ b/usr.sbin/bgpd/bgpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.c,v 1.70 2004/01/22 03:18:03 henning Exp $ */ +/* $OpenBSD: bgpd.c,v 1.71 2004/01/22 20:34:55 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -124,8 +124,7 @@ main(int argc, char *argv[]) break; case 'D': if (cmdline_symset(optarg) < 0) - logit(LOG_CRIT, - "could not parse macro definition %s", + log_warnx("could not parse macro definition %s", optarg); break; case 'f': @@ -165,7 +164,7 @@ main(int argc, char *argv[]) if (!debug) daemon(1, 0); - logit(LOG_INFO, "startup"); + log_info("startup"); if (pipe(pipe_m2s) == -1) fatal("pipe"); @@ -282,7 +281,7 @@ main(int argc, char *argv[]) } if (reconfig) { - logit(LOG_CRIT, "rereading config"); + log_info("rereading config"); reconfigure(conffile, &conf, &mrt_l, peer_l); reconfig = 0; } @@ -316,7 +315,7 @@ main(int argc, char *argv[]) control_cleanup(); kr_shutdown(); - logit(LOG_CRIT, "Terminating"); + log_info("Terminating"); return (0); } @@ -327,11 +326,11 @@ check_child(pid_t pid, const char *pname) if (waitpid(pid, &status, WNOHANG) > 0) { if (WIFEXITED(status)) { - logit(LOG_CRIT, "Lost child: %s exited", pname); + log_warnx("Lost child: %s exited", pname); return (1); } if (WIFSIGNALED(status)) { - logit(LOG_CRIT, "Lost child: %s terminated; signal %d", + log_warnx("Lost child: %s terminated; signal %d", pname, WTERMSIG(status)); return (1); } @@ -349,7 +348,7 @@ reconfigure(char *conffile, struct bgpd_config *conf, struct mrt_head *mrt_l, struct peer *p, *next; if (parse_config(conffile, conf, mrt_l, &peer_l, &net_l)) { - logit(LOG_CRIT, "config file %s has errors, not reloading", + log_warnx("config file %s has errors, not reloading", conffile); return (-1); } @@ -395,7 +394,7 @@ dispatch_imsg(struct imsgbuf *ibuf, int idx, struct mrt_head *mrt_l) return (-1); if (n == 0) { /* connection closed */ - logit(LOG_CRIT, "dispatch_imsg in main: pipe closed"); + log_warnx("dispatch_imsg in main: pipe closed"); return (-1); } @@ -410,54 +409,54 @@ dispatch_imsg(struct imsgbuf *ibuf, int idx, struct mrt_head *mrt_l) case IMSG_MRT_MSG: case IMSG_MRT_END: if (mrt_queue(mrt_l, &imsg) == -1) - logit(LOG_CRIT, "mrt_queue failed."); + log_warnx("mrt_queue failed."); break; case IMSG_KROUTE_CHANGE: if (idx != PFD_PIPE_ROUTE) - logit(LOG_CRIT, "route request not from RDE"); + log_warnx("route request not from RDE"); else if (kr_change(imsg.data)) return (-1); break; case IMSG_KROUTE_DELETE: if (idx != PFD_PIPE_ROUTE) - logit(LOG_CRIT, "route request not from RDE"); + log_warnx("route request not from RDE"); else if (kr_delete(imsg.data)) return (-1); break; case IMSG_NEXTHOP_ADD: if (idx != PFD_PIPE_ROUTE) - logit(LOG_CRIT, "nexthop request not from RDE"); + log_warnx("nexthop request not from RDE"); else if (imsg.hdr.len != IMSG_HEADER_SIZE + sizeof(struct bgpd_addr)) - logit(LOG_CRIT, "wrong imsg len"); + log_warnx("wrong imsg len"); else if (kr_nexthop_add(imsg.data) == -1) return (-1); break; case IMSG_NEXTHOP_REMOVE: if (idx != PFD_PIPE_ROUTE) - logit(LOG_CRIT, "nexthop request not from RDE"); + log_warnx("nexthop request not from RDE"); else if (imsg.hdr.len != IMSG_HEADER_SIZE + sizeof(struct bgpd_addr)) - logit(LOG_CRIT, "wrong imsg len"); + log_warnx("wrong imsg len"); else kr_nexthop_delete(imsg.data); break; case IMSG_CTL_RELOAD: if (idx != PFD_PIPE_SESSION) - logit(LOG_CRIT, "reload request not from SE"); + log_warnx("reload request not from SE"); else reconfig = 1; break; case IMSG_CTL_FIB_COUPLE: if (idx != PFD_PIPE_SESSION) - logit(LOG_CRIT, "couple request not from SE"); + log_warnx("couple request not from SE"); else kr_fib_couple(); break; case IMSG_CTL_FIB_DECOUPLE: if (idx != PFD_PIPE_SESSION) - logit(LOG_CRIT, "decouple request not from SE"); + log_warnx("decouple request not from SE"); else kr_fib_decouple(); break; @@ -466,7 +465,7 @@ dispatch_imsg(struct imsgbuf *ibuf, int idx, struct mrt_head *mrt_l) case IMSG_CTL_SHOW_NEXTHOP: case IMSG_CTL_SHOW_INTERFACE: if (idx != PFD_PIPE_SESSION) - logit(LOG_CRIT, "kroute request not from SE"); + log_warnx("kroute request not from SE"); else kr_show_route(&imsg); break; @@ -493,7 +492,7 @@ send_nexthop_update(struct kroute_nexthop *msg) if (msg->nexthop.af == AF_INET) nh = log_ntoa(msg->nexthop.v4.s_addr); - logit(LOG_INFO, "nexthop %s now %s%s%s", nh, + log_info("nexthop %s now %s%s%s", nh, msg->valid ? "valid" : "invalid", msg->connected ? ": directly connected" : "", msg->gateway.af ? gw : ""); diff --git a/usr.sbin/bgpd/config.c b/usr.sbin/bgpd/config.c index 3e7e6aef8cf..56b0823d91a 100644 --- a/usr.sbin/bgpd/config.c +++ b/usr.sbin/bgpd/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.17 2004/01/07 01:15:54 henning Exp $ */ +/* $OpenBSD: config.c,v 1.18 2004/01/22 20:34:55 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -42,7 +42,7 @@ merge_config(struct bgpd_config *xconf, struct bgpd_config *conf, /* merge conf (new) into xconf (old) */ if (!conf->as) { - logit(LOG_CRIT, "configuration error: AS not given"); + log_warnx("configuration error: AS not given"); return (1); } if (xconf->as != conf->as) diff --git a/usr.sbin/bgpd/control.c b/usr.sbin/bgpd/control.c index e6c34e4e46b..e00289e959c 100644 --- a/usr.sbin/bgpd/control.c +++ b/usr.sbin/bgpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.19 2004/01/22 03:18:03 henning Exp $ */ +/* $OpenBSD: control.c,v 1.20 2004/01/22 20:34:55 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -125,7 +125,7 @@ control_accept(int listenfd) } if (uid) { - logit(LOG_INFO, "Control connection attempt from uid %ld", uid); + log_info("Control connection attempt from uid %ld", uid); return; } @@ -246,10 +246,10 @@ control_dispatch_msg(struct pollfd *pfd, int i) if (p != NULL) bgp_fsm(p, EVNT_START); else - logit(LOG_CRIT, "IMSG_CTL_NEIGHBOR_UP " + log_warnx("IMSG_CTL_NEIGHBOR_UP " "with unknown neighbor"); } else - logit(LOG_CRIT, "got IMSG_CTL_NEIGHBOR_UP with " + log_warnx("got IMSG_CTL_NEIGHBOR_UP with " "wrong length"); break; case IMSG_CTL_NEIGHBOR_DOWN: @@ -260,10 +260,10 @@ control_dispatch_msg(struct pollfd *pfd, int i) if (p != NULL) bgp_fsm(p, EVNT_STOP); else - logit(LOG_CRIT, "IMSG_CTL_NEIGHBOR_DOWN" + log_warnx("IMSG_CTL_NEIGHBOR_DOWN" " with unknown neighbor"); } else - logit(LOG_CRIT, "got IMSG_CTL_NEIGHBOR_DOWN " + log_warnx("got IMSG_CTL_NEIGHBOR_DOWN " "with wrong length"); break; case IMSG_CTL_KROUTE: diff --git a/usr.sbin/bgpd/imsg.c b/usr.sbin/bgpd/imsg.c index 171570057ce..a566e6c6bb1 100644 --- a/usr.sbin/bgpd/imsg.c +++ b/usr.sbin/bgpd/imsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.c,v 1.21 2004/01/22 03:18:03 henning Exp $ */ +/* $OpenBSD: imsg.c,v 1.22 2004/01/22 20:34:56 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -71,7 +71,7 @@ imsg_get(struct imsgbuf *ibuf, struct imsg *imsg) memcpy(&imsg->hdr, ibuf->r.buf, sizeof(imsg->hdr)); if (imsg->hdr.len < IMSG_HEADER_SIZE || imsg->hdr.len > MAX_IMSGSIZE) { - logit(LOG_CRIT, "wrong imsg hdr len"); + log_warnx("imsg_get: imsg hdr len out of bounds"); return (-1); } if (imsg->hdr.len > av) @@ -122,23 +122,23 @@ imsg_compose_core(struct imsgbuf *ibuf, int type, u_int32_t peerid, void *data, hdr.pid = pid; wbuf = buf_open(hdr.len); if (wbuf == NULL) { - logit(LOG_CRIT, "imsg_compose: buf_open error"); + log_warnx("imsg_compose: buf_open error"); return (-1); } if (buf_add(wbuf, &hdr, sizeof(hdr)) == -1) { - logit(LOG_CRIT, "imsg_compose: buf_add error"); + log_warnx("imsg_compose: buf_add error"); buf_free(wbuf); return (-1); } if (datalen) if (buf_add(wbuf, data, datalen) == -1) { - logit(LOG_CRIT, "imsg_compose: buf_add error"); + log_warnx("imsg_compose: buf_add error"); buf_free(wbuf); return (-1); } if ((n = buf_close(&ibuf->w, wbuf)) < 0) { - logit(LOG_CRIT, "imsg_compose: buf_add error"); + log_warnx("imsg_compose: buf_add error"); buf_free(wbuf); return (-1); } diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c index ff73d3098b0..9a71c65e438 100644 --- a/usr.sbin/bgpd/kroute.c +++ b/usr.sbin/bgpd/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.76 2004/01/22 03:18:04 henning Exp $ */ +/* $OpenBSD: kroute.c,v 1.77 2004/01/22 20:34:56 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -231,7 +231,7 @@ kr_fib_couple(void) if ((kr->r.flags & F_BGPD_INSERTED)) send_rtmsg(kr_state.fd, RTM_ADD, &kr->r); - logit(LOG_INFO, "kernel routing table coupled"); + log_info("kernel routing table coupled"); } void @@ -248,7 +248,7 @@ kr_fib_decouple(void) kr_state.fib_sync = 0; - logit(LOG_INFO, "kernel routing table decoupled"); + log_info("kernel routing table decoupled"); } int @@ -316,7 +316,7 @@ kr_show_route(struct imsg *imsg) switch (imsg->hdr.type) { case IMSG_CTL_KROUTE: if (imsg->hdr.len != IMSG_HEADER_SIZE + sizeof(flags)) { - logit(LOG_CRIT, "kr_show_route: wrong imsg len"); + log_warnx("kr_show_route: wrong imsg len"); return; } memcpy(&flags, imsg->data, sizeof(flags)); @@ -328,7 +328,7 @@ kr_show_route(struct imsg *imsg) case IMSG_CTL_KROUTE_ADDR: if (imsg->hdr.len != IMSG_HEADER_SIZE + sizeof(struct bgpd_addr)) { - logit(LOG_CRIT, "kr_show_route: wrong imsg len"); + log_warnx("kr_show_route: wrong imsg len"); return; } addr = imsg->data; @@ -437,7 +437,7 @@ kroute_insert(struct kroute_node *kr) in_addr_t mask, ina; if (RB_INSERT(kroute_tree, &krt, kr) != NULL) { - logit(LOG_CRIT, "kroute_tree insert failed for %s/%u", + log_warnx("kroute_tree insert failed for %s/%u", log_ntoa(kr->r.prefix), kr->r.prefixlen); free(kr); return (-1); @@ -467,7 +467,7 @@ kroute_remove(struct kroute_node *kr) struct knexthop_node *s; if (RB_REMOVE(kroute_tree, &krt, kr) == NULL) { - logit(LOG_CRIT, "kroute_remove failed for %s/%u", + log_warnx("kroute_remove failed for %s/%u", log_ntoa(kr->r.prefix), kr->r.prefixlen); return (-1); } @@ -502,7 +502,7 @@ int knexthop_insert(struct knexthop_node *kn) { if (RB_INSERT(knexthop_tree, &knt, kn) != NULL) { - logit(LOG_CRIT, "knexthop_tree insert failed for %s", + log_warnx("knexthop_tree insert failed for %s", log_ntoa(kn->nexthop.v4.s_addr)); free(kn); return (-1); @@ -519,7 +519,7 @@ knexthop_remove(struct knexthop_node *kn) kroute_detach_nexthop(kn); if (RB_REMOVE(knexthop_tree, &knt, kn) == NULL) { - logit(LOG_CRIT, "knexthop_remove failed for %s", + log_warnx("knexthop_remove failed for %s", log_ntoa(kn->nexthop.v4.s_addr)); return (-1); } @@ -550,7 +550,7 @@ kif_insert(struct kif_node *kif) LIST_INIT(&kif->kroute_l); if (RB_INSERT(kif_tree, &kit, kif) != NULL) { - logit(LOG_CRIT, "RB_INSERT(kif_tree, &kit, kif)"); + log_warnx("RB_INSERT(kif_tree, &kit, kif)"); free(kif); return (-1); } @@ -564,7 +564,7 @@ kif_remove(struct kif_node *kif) struct kif_kr *kkr; if (RB_REMOVE(kif_tree, &kit, kif) == NULL) { - logit(LOG_CRIT, "RB_REMOVE(kif_tree, &kit, kif)"); + log_warnx("RB_REMOVE(kif_tree, &kit, kif)"); return (-1); } @@ -586,7 +586,7 @@ kif_kr_insert(struct kroute_node *kr) struct kif_kr *kkr; if ((kif = kif_find(kr->r.ifindex)) == NULL) { - logit(LOG_CRIT, "interface with index %u not found", + log_warnx("interface with index %u not found", kr->r.ifindex); return (0); } @@ -610,7 +610,7 @@ kif_kr_remove(struct kroute_node *kr) struct kif_kr *kkr; if ((kif = kif_find(kr->r.ifindex)) == NULL) { - logit(LOG_CRIT, "interface with index %u not found", + log_warnx("interface with index %u not found", kr->r.ifindex); return (0); } @@ -620,7 +620,7 @@ kif_kr_remove(struct kroute_node *kr) ; /* nothing */ if (kkr == NULL) { - logit(LOG_CRIT, "can't remove connected route from interface " + log_warnx("can't remove connected route from interface " "with index %u: not found", kr->r.ifindex); return (-1); } @@ -807,7 +807,7 @@ if_change(u_short ifindex, int flags, struct if_data *ifd) u_int8_t reachable; if ((kif = kif_find(ifindex)) == NULL) { - logit(LOG_CRIT, "interface with index %u not found", + log_warnx("interface with index %u not found", ifindex); return; } @@ -921,14 +921,12 @@ retry: r.hdr.rtm_type = RTM_ADD; goto retry; } else if (r.hdr.rtm_type == RTM_DELETE) { - logit(LOG_INFO, - "route %s/%u vanished before delete", + log_info("route %s/%u vanished before delete", log_ntoa(kroute->prefix), kroute->prefixlen); return (0); } else { - logit(LOG_CRIT, - "send_rtmsg: action %u, " + log_warnx("send_rtmsg: action %u, " "prefix %s/%u: %s", r.hdr.rtm_type, log_ntoa(kroute->prefix), kroute->prefixlen, strerror(errno)); @@ -936,8 +934,7 @@ retry: } break; default: - logit(LOG_CRIT, - "send_rtmsg: action %u, prefix %s/%u: %s", + log_warnx("send_rtmsg: action %u, prefix %s/%u: %s", r.hdr.rtm_type, log_ntoa(kroute->prefix), kroute->prefixlen, strerror(errno)); return (0); @@ -1125,7 +1122,7 @@ dispatch_rtmsg(void) } if (n == 0) { - logit(LOG_CRIT, "routing socket closed"); + log_warnx("routing socket closed"); return (-1); } @@ -1189,8 +1186,7 @@ dispatch_rtmsg(void) case RTM_ADD: case RTM_CHANGE: if (nexthop == 0 && !(flags & F_CONNECTED)) { - logit(LOG_CRIT, - "dispatch_rtmsg: no nexthop for %s/%u", + log_warnx("dispatch_rtmsg no nexthop for %s/%u", log_ntoa(prefix), prefixlen); continue; } diff --git a/usr.sbin/bgpd/mrt.c b/usr.sbin/bgpd/mrt.c index 0f1c75d650c..05b43c7953d 100644 --- a/usr.sbin/bgpd/mrt.c +++ b/usr.sbin/bgpd/mrt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mrt.c,v 1.22 2004/01/11 21:47:20 claudio Exp $ */ +/* $OpenBSD: mrt.c,v 1.23 2004/01/22 20:34:56 henning Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> @@ -50,7 +50,7 @@ static int mrt_open(struct mrt *); do { \ u_char t = (b); \ if (buf_add((x), &t, sizeof(t)) == -1) { \ - logit(LOG_ERR, "mrt_dump1: buf_add error"); \ + log_warnx("mrt_dump1: buf_add error"); \ buf_free(buf); \ return (-1); \ } \ @@ -61,7 +61,7 @@ static int mrt_open(struct mrt *); u_int16_t t; \ t = htons((s)); \ if (buf_add((x), &t, sizeof(t)) == -1) { \ - logit(LOG_ERR, "mrt_dump2: buf_add error"); \ + log_warnx("mrt_dump2: buf_add error"); \ buf_free(buf); \ return (-1); \ } \ @@ -72,7 +72,7 @@ static int mrt_open(struct mrt *); u_int32_t t; \ t = htonl((l)); \ if (buf_add((x), &t, sizeof(t)) == -1) { \ - logit(LOG_ERR, "mrt_dump3: buf_add error"); \ + log_warnx("mrt_dump3: buf_add error"); \ buf_free(buf); \ return (-1); \ } \ @@ -82,7 +82,7 @@ static int mrt_open(struct mrt *); do { \ u_int32_t t = (l); \ if (buf_add((x), &t, sizeof(t)) == -1) { \ - logit(LOG_ERR, "mrt_dump4: buf_add error"); \ + log_warnx("mrt_dump4: buf_add error"); \ buf_free(buf); \ return (-1); \ } \ @@ -104,18 +104,18 @@ mrt_dump_bgp_msg(struct mrt_config *mrt, void *pkg, u_int16_t pkglen, int type, hdr.peerid = mrt->id; buf = buf_open(hdr.len); if (buf == NULL) { - logit(LOG_ERR, "mrt_dump_bgp_msg: buf_open error"); + log_warnx("mrt_dump_bgp_msg: buf_open error"); return (-1); } if (buf_add(buf, &hdr, sizeof(hdr)) == -1) { - logit(LOG_ERR, "mrt_dump_bgp_msg: buf_add error"); + log_warnx("mrt_dump_bgp_msg: buf_add error"); buf_free(buf); return (-1); } if (mrt_dump_header(buf, MSG_PROTOCOL_BGP4MP, BGP4MP_MESSAGE, len) == -1) { - logit(LOG_ERR, "mrt_dump_bgp_msg: buf_add error"); + log_warnx("mrt_dump_bgp_msg: buf_add error"); return (-1); } @@ -135,13 +135,13 @@ mrt_dump_bgp_msg(struct mrt_config *mrt, void *pkg, u_int16_t pkglen, int type, } if (buf_add(buf, pkg, pkglen) == -1) { - logit(LOG_ERR, "mrt_dump_bgp_msg: buf_add error"); + log_warnx("mrt_dump_bgp_msg: buf_add error"); buf_free(buf); return (-1); } if ((n = buf_close(mrt->msgbuf, buf)) < 0) { - logit(LOG_ERR, "mrt_dump_bgp_msg: buf_close error"); + log_warnx("mrt_dump_bgp_msg: buf_close error"); buf_free(buf); return (-1); } @@ -164,18 +164,18 @@ mrt_dump_state(struct mrt_config *mrt, u_int16_t old_state, u_int16_t new_state, hdr.peerid = mrt->id; buf = buf_open(hdr.len); if (buf == NULL) { - logit(LOG_ERR, "mrt_dump_bgp_msg: buf_open error"); + log_warnx("mrt_dump_bgp_msg: buf_open error"); return (-1); } if (buf_add(buf, &hdr, sizeof(hdr)) == -1) { - logit(LOG_ERR, "mrt_dump_bgp_msg: buf_add error"); + log_warnx("mrt_dump_bgp_msg: buf_add error"); buf_free(buf); return (-1); } if (mrt_dump_header(buf, MSG_PROTOCOL_BGP4MP, BGP4MP_STATE_CHANGE, len) == -1) { - logit(LOG_ERR, "mrt_dump_bgp_msg: buf_add error"); + log_warnx("mrt_dump_bgp_msg: buf_add error"); return (-1); } @@ -190,7 +190,7 @@ mrt_dump_state(struct mrt_config *mrt, u_int16_t old_state, u_int16_t new_state, DUMP_SHORT(buf, new_state); if ((n = buf_close(mrt->msgbuf, buf)) < 0) { - logit(LOG_ERR, "mrt_dump_bgp_msg: buf_close error"); + log_warnx("mrt_dump_bgp_msg: buf_close error"); buf_free(buf); return (-1); } @@ -290,17 +290,17 @@ mrt_dump_entry(struct mrt_config *mrt, struct prefix *p, u_int16_t snum, hdr.peerid = mrt->id; buf = buf_open(hdr.len); if (buf == NULL) { - logit(LOG_ERR, "mrt_dump_entry: buf_open error"); + log_warnx("mrt_dump_entry: buf_open error"); return (-1); } if (buf_add(buf, &hdr, sizeof(hdr)) == -1) { - logit(LOG_ERR, "mrt_dump_entry: buf_add error"); + log_warnx("mrt_dump_entry: buf_add error"); buf_free(buf); return (-1); } if (mrt_dump_header(buf, MSG_TABLE_DUMP, AFI_IPv4, len) == -1) { - logit(LOG_ERR, "mrt_dump_bgp_msg: buf_add error"); + log_warnx("mrt_dump_bgp_msg: buf_add error"); return (-1); } @@ -315,19 +315,19 @@ mrt_dump_entry(struct mrt_config *mrt, struct prefix *p, u_int16_t snum, DUMP_SHORT(buf, attr_len); if ((bptr = buf_reserve(buf, attr_len)) == NULL) { - logit(LOG_ERR, "mrt_dump_entry: buf_reserve error"); + log_warnx("mrt_dump_entry: buf_reserve error"); buf_free(buf); return (-1); } if (mrt_attr_dump(bptr, attr_len, &p->aspath->flags) == -1) { - logit(LOG_ERR, "mrt_dump_entry: mrt_attr_dump error"); + log_warnx("mrt_dump_entry: mrt_attr_dump error"); buf_free(buf); return (-1); } if ((n = buf_close(mrt->msgbuf, buf)) < 0) { - logit(LOG_ERR, "mrt_dump_entry: buf_close error"); + log_warnx("mrt_dump_entry: buf_close error"); buf_free(buf); return (-1); } @@ -391,7 +391,7 @@ mrt_open(struct mrt *mrt) now = time(NULL); if (strftime(mrt->file, sizeof(mrt->file), mrt->name, localtime(&now)) == 0) { - logit(LOG_ERR, "mrt_open: strftime conversion failed"); + log_warnx("mrt_open: strftime conversion failed"); mrt->msgbuf.sock = -1; return (0); } @@ -399,7 +399,7 @@ mrt_open(struct mrt *mrt) mrt->msgbuf.sock = open(mrt->file, O_WRONLY|O_NONBLOCK|O_CREAT|O_TRUNC, 0644); if (mrt->msgbuf.sock == -1) { - logit(LOG_ERR, "mrt_open %s: %s", + log_warnx("mrt_open %s: %s", mrt->file, strerror(errno)); return (0); } @@ -502,7 +502,7 @@ mrt_write(struct mrt *mrt) case 0: if (mrt->state == MRT_STATE_CLOSE && mrt->msgbuf.queued == 0) { if (mrt_close(mrt) != 1) { - logit(LOG_ERR, "mrt_write: mrt_close failed"); + log_warnx("mrt_write: mrt_close failed"); mrt_abort(mrt); return (0); } @@ -510,12 +510,12 @@ mrt_write(struct mrt *mrt) } return (0); case -1: - logit(LOG_ERR, "mrt_write: msgbuf_write: %s", + log_warnx("mrt_write: msgbuf_write: %s", strerror(errno)); mrt_abort(mrt); return (0); case -2: - logit(LOG_ERR, "mrt_write: msgbuf_write: %s", + log_warnx("mrt_write: msgbuf_write: %s", "connection closed"); mrt_abort(mrt); return (0); @@ -524,7 +524,7 @@ mrt_write(struct mrt *mrt) } if (mrt_close(mrt) != 1) { - logit(LOG_ERR, "mrt_write: mrt_close failed"); + log_warnx("mrt_write: mrt_close failed"); mrt_abort(mrt); return (0); } @@ -658,7 +658,7 @@ mrt_select(struct mrt_head *mc, struct pollfd *pfd, struct mrt **mrt, if (m->msgbuf.queued > 0) { if (m->msgbuf.sock == -1 || m->state == MRT_STATE_STOPPED) { - logit(LOG_ERR, "mrt_select: orphaned buffer"); + log_warnx("mrt_select: orphaned buffer"); mrt_abort(m); continue; } diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c index 082f67df21b..4e3d9ad8111 100644 --- a/usr.sbin/bgpd/rde.c +++ b/usr.sbin/bgpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.64 2004/01/17 19:35:36 claudio Exp $ */ +/* $OpenBSD: rde.c,v 1.65 2004/01/22 20:34:56 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -139,7 +139,7 @@ rde_main(struct bgpd_config *config, struct peer *peer_l, network_init(net_l); - logit(LOG_INFO, "route decision engine ready"); + log_info("route decision engine ready"); while (rde_quit == 0) { bzero(&pfd, sizeof(pfd)); @@ -179,7 +179,7 @@ rde_main(struct bgpd_config *config, struct peer *peer_l, rde_update_queue_runner(); } - logit(LOG_INFO, "route decision engine exiting"); + log_info("route decision engine exiting"); _exit(0); } @@ -283,7 +283,7 @@ rde_dispatch_imsg_parent(struct imsgbuf *ibuf) free(nconf); nconf = NULL; prefix_network_clean(&peerself, reloadtime); - logit(LOG_INFO, "RDE reconfigured"); + log_info("RDE reconfigured"); break; case IMSG_NEXTHOP_UPDATE: nexthop_update(imsg.data); @@ -399,8 +399,8 @@ rde_update_dispatch(struct imsg *imsg) nlri_len -= pos; rde_update_log("update", peer, &attrs, &prefix, prefixlen); if (peer->prefix_cnt >= peer->conf.max_prefix) { - logit(LOG_CRIT, "peer %s max prefix limit reached", - peer->conf.descr); + log_warnx("peer %s: prefix limit reached", + peer->conf.descr); /* LXXX */ rde_update_err(peer, ERR_UPD_UNSPECIFIC); break; } @@ -506,8 +506,7 @@ rde_update_get_attr(struct rde_peer *peer, u_char *p, u_int16_t len, if ((r = aspath_verify(p, attr_len, conf->as)) != 0) { /* XXX could also be a aspath loop but this * check should be moved to the filtering. */ - logit(LOG_INFO, - "XXX aspath_verify failed: error %i\n", r); + log_warnx("XXX aspath_verify failed: error %i", r); return (-1); } a->aspath = aspath_create(p, attr_len); @@ -828,7 +827,7 @@ peer_up(u_int32_t id, struct session_up *sup) peer = peer_get(id); if (peer == NULL) { - logit(LOG_CRIT, "peer_up: unknown peer id %d", id); + log_warnx("peer_up: unknown peer id %d", id); return; } @@ -850,7 +849,7 @@ peer_down(u_int32_t id) peer = peer_get(id); if (peer == NULL) { - logit(LOG_CRIT, "peer_down: unknown peer id &d", id); + log_warnx("peer_down: unknown peer id &d", id); return; } peer->remote_bgpid = 0; @@ -909,8 +908,6 @@ network_add(struct network_config *nc) attrs.origin = ORIGIN_IGP; TAILQ_INIT(&attrs.others); - logit(LOG_DEBUG, "adding network %s/%d", - inet_ntoa(nc->prefix.v4), nc->prefixlen); path_update(&peerself, &attrs, &nc->prefix, nc->prefixlen); } diff --git a/usr.sbin/bgpd/rde_decide.c b/usr.sbin/bgpd/rde_decide.c index 34e24e01dc4..c685a2f7dc0 100644 --- a/usr.sbin/bgpd/rde_decide.c +++ b/usr.sbin/bgpd/rde_decide.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_decide.c,v 1.23 2004/01/18 00:44:44 deraadt Exp $ */ +/* $OpenBSD: rde_decide.c,v 1.24 2004/01/22 20:34:56 henning Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> @@ -360,7 +360,7 @@ up_add(struct rde_peer *peer, struct update_prefix *p, struct update_attr *a) /* 1.1 if not found -> add */ TAILQ_INIT(&a->prefix_h); if (RB_INSERT(uptree_attr, &peer->up_attrs, a) != NULL) { - logit(LOG_CRIT, "uptree_attr insert failed"); + log_warnx("uptree_attr insert failed"); return (-1); } TAILQ_INSERT_TAIL(&peer->updates, a, attr_l); @@ -380,7 +380,7 @@ up_add(struct rde_peer *peer, struct update_prefix *p, struct update_attr *a) if ((np = RB_FIND(uptree_prefix, &peer->up_prefix, p)) == NULL) { /* 2.1 if not found -> add */ if (RB_INSERT(uptree_prefix, &peer->up_prefix, p) != NULL) { - logit(LOG_CRIT, "uptree_prefix insert failed"); + log_warnx("uptree_prefix insert failed"); return (-1); } peer->up_pcnt++; @@ -456,7 +456,7 @@ up_generate_updates(struct rde_peer *peer, p->prefix = old->prefix->prefix; p->prefixlen = old->prefix->prefixlen; if (up_add(peer, p, NULL) == -1) - logit(LOG_CRIT, "queuing update failed."); + log_warnx("queuing update failed."); } else { if (peer == new->peer) /* Do not send routes back to sender */ @@ -493,8 +493,7 @@ up_generate_updates(struct rde_peer *peer, if (up_generate_attr(peer, a, &new->aspath->flags, new->aspath->nexthop) == -1) - logit(LOG_CRIT, - "generation of bgp path attributes failed"); + log_warnx("generation of bgp path attributes failed"); /* * use aspath_hash as attr_hash, this may be unoptimal @@ -505,7 +504,7 @@ up_generate_updates(struct rde_peer *peer, p->prefixlen = new->prefix->prefixlen; if (up_add(peer, p, a) == -1) - logit(LOG_CRIT, "queuing update failed."); + log_warnx("queuing update failed."); } } @@ -672,7 +671,7 @@ up_dump_prefix(u_char *buf, int len, struct uplist_prefix *prefix_head, break; wpos += r; if (RB_REMOVE(uptree_prefix, &peer->up_prefix, upp) == NULL) - logit(LOG_CRIT, "dequeuing update failed."); + log_warnx("dequeuing update failed."); TAILQ_REMOVE(upp->prefix_h, upp, prefix_l); peer->up_pcnt--; if (upp->prefix_h == &peer->withdraws) @@ -718,7 +717,7 @@ up_dump_attrnlri(u_char *buf, int len, struct rde_peer *peer) /* now check if all prefixes where written */ if (TAILQ_EMPTY(&upa->prefix_h)) { if (RB_REMOVE(uptree_attr, &peer->up_attrs, upa) == NULL) - logit(LOG_CRIT, "dequeuing update failed."); + log_warnx("dequeuing update failed."); TAILQ_REMOVE(&peer->updates, upa, attr_l); free(upa); peer->up_acnt--; diff --git a/usr.sbin/bgpd/rde_rib.c b/usr.sbin/bgpd/rde_rib.c index fa08d390b1e..cc76ea1a6da 100644 --- a/usr.sbin/bgpd/rde_rib.c +++ b/usr.sbin/bgpd/rde_rib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_rib.c,v 1.26 2004/01/18 00:44:44 deraadt Exp $ */ +/* $OpenBSD: rde_rib.c,v 1.27 2004/01/22 20:34:56 henning Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> @@ -793,7 +793,7 @@ prefix_move(struct rde_aspath *asp, struct prefix *p) asp->peer->prefix_cnt++; /* XXX for debugging */ if (asp->prefix_cnt == MAX_PREFIX_PER_AS) - logit(LOG_INFO, "RDE: prefix hog, prefix %s/%d", + log_warnx("RDE: prefix hog, prefix %s/%d", inet_ntoa(np->prefix->prefix.v4), np->prefix->prefixlen); ENSURE(asp->prefix_cnt < MAX_PREFIX_PER_AS); @@ -958,7 +958,7 @@ prefix_link(struct prefix *pref, struct pt_entry *pte, struct rde_aspath *asp) /* XXX for debugging */ if (asp->prefix_cnt == MAX_PREFIX_PER_AS) - logit(LOG_INFO, "RDE: prefix hog, prefix %s/%d", + log_warnx("RDE: prefix hog, prefix %s/%d", inet_ntoa(pte->prefix.v4), pte->prefixlen); ENSURE(asp->prefix_cnt < MAX_PREFIX_PER_AS); @@ -1167,7 +1167,7 @@ nexthop_update(struct kroute_nexthop *msg) nh = nexthop_get(msg->nexthop.v4.s_addr); if (nh == NULL) { - logit(LOG_INFO, "nexthop_update: non-existent nexthop"); + log_warnx("nexthop_update: non-existent nexthop"); return; } ENSURE(nh->exit_nexthop.v4.s_addr == msg->nexthop.v4.s_addr); diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c index 0abde2e03ff..e65d526dfcf 100644 --- a/usr.sbin/bgpd/session.c +++ b/usr.sbin/bgpd/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.90 2004/01/22 19:07:34 henning Exp $ */ +/* $OpenBSD: session.c,v 1.91 2004/01/22 20:34:56 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -178,7 +178,7 @@ session_main(struct bgpd_config *config, struct peer *cpeers, int pipe_m2s[2], signal(SIGTERM, session_sighdlr); signal(SIGPIPE, SIG_IGN); - logit(LOG_INFO, "session engine ready"); + log_info("session engine ready"); close(pipe_m2s[0]); close(pipe_s2r[1]); init_conf(conf); @@ -336,7 +336,7 @@ session_main(struct bgpd_config *config, struct peer *cpeers, int pipe_m2s[2], } control_shutdown(); - logit(LOG_INFO, "session engine exiting"); + log_info("session engine exiting"); _exit(0); } @@ -933,7 +933,7 @@ session_update(u_int32_t peerid, void *data, size_t datalen) int errs = 0, n; if ((p = getpeerbyid(peerid)) == NULL) { - logit(LOG_CRIT, "no such peer: id=%u", peerid); + log_warnx("no such peer: id=%u", peerid); return; } @@ -1032,7 +1032,7 @@ session_dispatch_msg(struct pollfd *pfd, struct peer *peer) len = sizeof(error); if (getsockopt(pfd->fd, SOL_SOCKET, SO_ERROR, &error, &len) == -1) - logit(LOG_CRIT, "unknown socket error"); + log_warnx("unknown socket error"); else { errno = error; log_peer_warn(peer, "socket error"); @@ -1129,9 +1129,8 @@ session_dispatch_msg(struct pollfd *pfd, struct peer *peer) default: /* cannot happen */ session_notification(peer, ERR_HEADER, ERR_HDR_TYPE, &msgtype, 1); - logit(LOG_CRIT, - "received message with unknown type" - " %u", msgtype); + log_warnx("received message with " + "unknown type %u", msgtype); } rpos += msglen; } @@ -1447,7 +1446,7 @@ session_dispatch_imsg(struct imsgbuf *ibuf, int idx) free(nconf); nconf = NULL; pending_reconf = 0; - logit(LOG_INFO, "SE reconfigured"); + log_info("SE reconfigured"); break; case IMSG_MRT_REQ: memcpy(&mrt, imsg.data, sizeof(mrt)); @@ -1480,7 +1479,7 @@ session_dispatch_imsg(struct imsgbuf *ibuf, int idx) MAX_PKTSIZE - MSGSIZE_HEADER || imsg.hdr.len < IMSG_HEADER_SIZE + MSGSIZE_UPDATE_MIN - MSGSIZE_HEADER) - logit(LOG_CRIT, "RDE sent invalid update"); + log_warnx("RDE sent invalid update"); else session_update(imsg.hdr.peerid, imsg.data, imsg.hdr.len - IMSG_HEADER_SIZE); @@ -1489,12 +1488,11 @@ session_dispatch_imsg(struct imsgbuf *ibuf, int idx) if (idx != PFD_PIPE_ROUTE) fatalx("update request not from RDE"); if (imsg.hdr.len != IMSG_HEADER_SIZE + sizeof(suberr)) { - logit(LOG_CRIT, - "RDE sent invalid notification"); + log_warnx("RDE sent invalid notification"); break; } if ((p = getpeerbyid(imsg.hdr.peerid)) == NULL) - logit(LOG_CRIT, "no such peer: id=%u", + log_warnx("no such peer: id=%u", imsg.hdr.peerid); else { memcpy(&suberr, imsg.data, sizeof(suberr)); |