summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2020-11-02 00:30:56 +0000
committerdlg <dlg@openbsd.org>2020-11-02 00:30:56 +0000
commit27198fece99bdcb6d984ac315c4c48ba580fc30f (patch)
tree6cd699c03c12a104be972f31a35f0825402592bb
parentapply the "depend on" logic in the the default handling of rtr links. (diff)
downloadwireguard-openbsd-27198fece99bdcb6d984ac315c4c48ba580fc30f.tar.xz
wireguard-openbsd-27198fece99bdcb6d984ac315c4c48ba580fc30f.zip
print "depend on" information when available in "ospfctl sh int" output.
ok remi@
-rw-r--r--usr.sbin/ospfctl/output.c7
-rw-r--r--usr.sbin/ospfd/interface.c5
-rw-r--r--usr.sbin/ospfd/ospfd.h4
3 files changed, 13 insertions, 3 deletions
diff --git a/usr.sbin/ospfctl/output.c b/usr.sbin/ospfctl/output.c
index 12d3f8249a9..29d01cc545b 100644
--- a/usr.sbin/ospfctl/output.c
+++ b/usr.sbin/ospfctl/output.c
@@ -170,10 +170,15 @@ show_interface(struct ctl_iface *iface, int detail)
printf(" Router ID %s, network type %s, cost: %d\n",
inet_ntoa(iface->rtr_id),
if_type_name(iface->type), iface->metric);
+ if (iface->dependon[0] != '\0') {
+ printf(" Depends on %s, %s\n", iface->dependon,
+ iface->depend_ok ? "up" : "down");
+ }
printf(" Transmit delay is %d sec(s), state %s, priority %d\n",
iface->transmit_delay, if_state_name(iface->state),
iface->priority);
- printf(" Designated Router (ID) %s, ", inet_ntoa(iface->dr_id));
+ printf(" Designated Router (ID) %s, ",
+ inet_ntoa(iface->dr_id));
printf("interface address %s\n", inet_ntoa(iface->dr_addr));
printf(" Backup Designated Router (ID) %s, ",
inet_ntoa(iface->bdr_id));
diff --git a/usr.sbin/ospfd/interface.c b/usr.sbin/ospfd/interface.c
index 1d966f34b59..7911f05bb38 100644
--- a/usr.sbin/ospfd/interface.c
+++ b/usr.sbin/ospfd/interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.c,v 1.83 2019/06/28 13:32:49 deraadt Exp $ */
+/* $OpenBSD: interface.c,v 1.84 2020/11/02 00:30:56 dlg Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -633,6 +633,9 @@ if_to_ctl(struct iface *iface)
ictl.auth_type = iface->auth_type;
ictl.auth_keyid = iface->auth_keyid;
+ memcpy(ictl.dependon, iface->dependon, sizeof(ictl.dependon));
+ ictl.depend_ok = iface->depend_ok;
+
gettimeofday(&now, NULL);
if (evtimer_pending(&iface->hello_timer, &tv)) {
timersub(&tv, &now, &res);
diff --git a/usr.sbin/ospfd/ospfd.h b/usr.sbin/ospfd/ospfd.h
index 5ea537cb2f3..49a2c54fc03 100644
--- a/usr.sbin/ospfd/ospfd.h
+++ b/usr.sbin/ospfd/ospfd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfd.h,v 1.106 2020/01/21 20:38:52 remi Exp $ */
+/* $OpenBSD: ospfd.h,v 1.107 2020/11/02 00:30:56 dlg Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -485,6 +485,8 @@ struct ctl_iface {
u_int8_t passive;
enum auth_type auth_type;
u_int8_t auth_keyid;
+ char dependon[IF_NAMESIZE];
+ int depend_ok;
};
struct ctl_nbr {