summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ospfd/interface.c
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2006-03-09 15:43:21 +0000
committerclaudio <claudio@openbsd.org>2006-03-09 15:43:21 +0000
commitcdd382039c84a7439b1f17677563fd8a293f35e3 (patch)
treeaa3c527ffa5e34bbb05e4915cd90a2677e053939 /usr.sbin/ospfd/interface.c
parentshould have been part of previous commit (add rcstime.c here too). (diff)
downloadwireguard-openbsd-cdd382039c84a7439b1f17677563fd8a293f35e3.tar.xz
wireguard-openbsd-cdd382039c84a7439b1f17677563fd8a293f35e3.zip
Move *_name functions to log.c and use these for both ospfd and ospfctl.
Stuff that is only used in ospfd debug messages is simplified. OK norby@
Diffstat (limited to 'usr.sbin/ospfd/interface.c')
-rw-r--r--usr.sbin/ospfd/interface.c70
1 files changed, 4 insertions, 66 deletions
diff --git a/usr.sbin/ospfd/interface.c b/usr.sbin/ospfd/interface.c
index fa2eaf4afd3..7bee9a1b0d9 100644
--- a/usr.sbin/ospfd/interface.c
+++ b/usr.sbin/ospfd/interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.c,v 1.44 2006/03/09 13:37:04 claudio Exp $ */
+/* $OpenBSD: interface.c,v 1.45 2006/03/09 15:43:21 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -87,20 +87,6 @@ const char * const if_action_names[] = {
"RESET"
};
-const char * const if_type_names[] = {
- "POINTOPOINT",
- "BROADCAST",
- "NBMA",
- "POINTOMULTIPOINT",
- "VIRTUALLINK"
-};
-
-const char * const if_auth_names[] = {
- "none",
- "simple",
- "crypt"
-};
-
int
if_fsm(struct iface *iface, enum iface_event event)
{
@@ -121,7 +107,7 @@ if_fsm(struct iface *iface, enum iface_event event)
/* event outside of the defined fsm, ignore it. */
log_debug("if_fsm: interface %s, "
"event %s not expected in state %s", iface->name,
- if_event_name(event), if_state_name(old_state));
+ if_event_names[event], if_state_name(old_state));
return (0);
}
@@ -142,7 +128,7 @@ if_fsm(struct iface *iface, enum iface_event event)
if (ret) {
log_debug("if_fsm: error changing state for interface %s, "
- "event %s, state %s", iface->name, if_event_name(event),
+ "event %s, state %s", iface->name, if_event_names[event],
if_state_name(old_state));
return (-1);
}
@@ -155,7 +141,7 @@ if_fsm(struct iface *iface, enum iface_event event)
log_debug("if_fsm: event %s resulted in action %s and changing "
"state for interface %s from %s to %s",
- if_event_name(event), if_action_name(iface_fsm[i].action),
+ if_event_names[event], if_action_names[iface_fsm[i].action],
iface->name, if_state_name(old_state), if_state_name(iface->state));
return (ret);
@@ -694,54 +680,6 @@ if_to_ctl(struct iface *iface)
return (&ictl);
}
-/* names */
-const char *
-if_state_name(int state)
-{
- switch (state) {
- case IF_STA_DOWN:
- return ("DOWN");
- case IF_STA_LOOPBACK:
- return ("LOOPBACK");
- case IF_STA_WAITING:
- return ("WAITING");
- case IF_STA_POINTTOPOINT:
- return ("POINT-TO-POINT");
- case IF_STA_DROTHER:
- return ("DROTHER");
- case IF_STA_BACKUP:
- return ("BACKUP");
- case IF_STA_DR:
- return ("DR");
- default:
- return ("UNKNOWN");
- }
-}
-
-const char *
-if_event_name(int event)
-{
- return (if_event_names[event]);
-}
-
-const char *
-if_action_name(int action)
-{
- return (if_action_names[action]);
-}
-
-const char *
-if_type_name(int type)
-{
- return (if_type_names[type]);
-}
-
-const char *
-if_auth_name(int type)
-{
- return (if_auth_names[type]);
-}
-
/* misc */
int
if_set_mcast_ttl(int fd, u_int8_t ttl)