diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-03-26 13:35:17 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-03-26 13:35:17 +0000 |
commit | 2148e07ae93d0aa4b2092b618b760504a72bb447 (patch) | |
tree | 84ca3bdc78d57befd7d6cd48a1b7caf39802c1e8 /usr.sbin | |
parent | 157fdfd36d3799a3e0ef51e8690303a3e4cdbff8 (diff) |
Implement the IMSG_CTL_IFINFO bits correctly. This is needed for
"ospfctl show fib interface".
OK henning@ norby@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ospfd/control.c | 3 | ||||
-rw-r--r-- | usr.sbin/ospfd/kroute.c | 13 | ||||
-rw-r--r-- | usr.sbin/ospfd/ospfd.c | 10 | ||||
-rw-r--r-- | usr.sbin/ospfd/ospfd.h | 4 |
4 files changed, 17 insertions, 13 deletions
diff --git a/usr.sbin/ospfd/control.c b/usr.sbin/ospfd/control.c index a217b9600af..bbd8231e6e0 100644 --- a/usr.sbin/ospfd/control.c +++ b/usr.sbin/ospfd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.9 2005/03/22 22:13:48 norby Exp $ */ +/* $OpenBSD: control.c,v 1.10 2005/03/26 13:35:16 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -228,6 +228,7 @@ control_dispatch_imsg(int fd, short event, void *bula) break; case IMSG_CTL_KROUTE: case IMSG_CTL_KROUTE_ADDR: + case IMSG_CTL_IFINFO: c->ibuf.pid = imsg.hdr.pid; ospfe_imsg_compose_parent(imsg.hdr.type, imsg.hdr.pid, imsg.data, diff --git a/usr.sbin/ospfd/kroute.c b/usr.sbin/ospfd/kroute.c index 42aaf54c664..480abc83687 100644 --- a/usr.sbin/ospfd/kroute.c +++ b/usr.sbin/ospfd/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.11 2005/03/26 11:06:49 claudio Exp $ */ +/* $OpenBSD: kroute.c,v 1.12 2005/03/26 13:35:16 claudio Exp $ */ /* * Copyright (c) 2004 Esben Norby <norby@openbsd.org> @@ -311,16 +311,17 @@ kr_show_route(struct imsg *imsg) } void -kr_ifinfo(char *ifname) +kr_ifinfo(char *ifname, pid_t pid) { struct kif_node *kif; RB_FOREACH(kif, kif_tree, &kit) - if (!strcmp(ifname, kif->k.ifname)) { - main_imsg_compose_ospfe(IMSG_CTL_IFINFO, 0, - &kif->k, sizeof(kif->k)); - return; + if (ifname == NULL || !strcmp(ifname, kif->k.ifname)) { + main_imsg_compose_ospfe(IMSG_CTL_IFINFO, + pid, &kif->k, sizeof(kif->k)); } + + main_imsg_compose_ospfe(IMSG_CTL_END, pid, NULL, 0); } /* rb-tree compare */ diff --git a/usr.sbin/ospfd/ospfd.c b/usr.sbin/ospfd/ospfd.c index dc6ca68b070..c8967e66913 100644 --- a/usr.sbin/ospfd/ospfd.c +++ b/usr.sbin/ospfd/ospfd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfd.c,v 1.12 2005/03/26 11:04:28 henning Exp $ */ +/* $OpenBSD: ospfd.c,v 1.13 2005/03/26 13:35:16 claudio Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -338,10 +338,12 @@ main_dispatch_ospfe(int fd, short event, void *bula) kr_show_route(&imsg); break; case IMSG_CTL_IFINFO: - if (imsg.hdr.len != IMSG_HEADER_SIZE + IFNAMSIZ) - log_warnx("IFINFO request with wrong len"); + if (imsg.hdr.len == IMSG_HEADER_SIZE) + kr_ifinfo(NULL, imsg.hdr.pid); + else if (imsg.hdr.len == IMSG_HEADER_SIZE + IFNAMSIZ) + kr_ifinfo(imsg.data, imsg.hdr.pid); else - kr_ifinfo(imsg.data); + log_warnx("IFINFO request with wrong len"); break; default: log_debug("main_dispatch_ospfe: error handling imsg %d", diff --git a/usr.sbin/ospfd/ospfd.h b/usr.sbin/ospfd/ospfd.h index 517d3d14aaf..ccafbb988ce 100644 --- a/usr.sbin/ospfd/ospfd.h +++ b/usr.sbin/ospfd/ospfd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfd.h,v 1.21 2005/03/26 11:06:49 claudio Exp $ */ +/* $OpenBSD: ospfd.h,v 1.22 2005/03/26 13:35:16 claudio Exp $ */ /* * Copyright (c) 2004 Esben Norby <norby@openbsd.org> @@ -482,7 +482,7 @@ void kr_dispatch_msg(int, short, void *); int kr_nexthop_add(struct in_addr); void kr_nexthop_delete(struct in_addr); void kr_show_route(struct imsg *); -void kr_ifinfo(char *); +void kr_ifinfo(char *, pid_t); struct kif *kif_findname(char *); u_int8_t mask2prefixlen(in_addr_t); |