diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-01-23 21:17:52 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-01-23 21:17:52 +0000 |
commit | 0e80557cc9312a6f3f649058f90e9a70652e6882 (patch) | |
tree | 7ff87c2214596e3c352a0747d69fed894ba7298b | |
parent | 7cb5c8ff7c9d79ced51c98029197a952c66eb544 (diff) |
provide log_addr, which takes a struct bgpd_addr
intended to replace log_ntoa in most cases becaus that is IPv4 only by design
-rw-r--r-- | usr.sbin/bgpd/bgpd.h | 3 | ||||
-rw-r--r-- | usr.sbin/bgpd/log.c | 12 |
2 files changed, 13 insertions, 2 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h index 9cf7b38fa94..6d84eb1cf4d 100644 --- a/usr.sbin/bgpd/bgpd.h +++ b/usr.sbin/bgpd/bgpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.h,v 1.78 2004/01/22 21:08:59 henning Exp $ */ +/* $OpenBSD: bgpd.h,v 1.79 2004/01/23 21:17:51 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -292,6 +292,7 @@ void fatal(const char *); void fatalx(const char *); void fatal_ensure(const char *, int, const char *); char *log_ntoa(in_addr_t); +char *log_addr(struct bgpd_addr *); /* parse.y */ int cmdline_symset(char *); diff --git a/usr.sbin/bgpd/log.c b/usr.sbin/bgpd/log.c index 40669a22521..da69ff0ce33 100644 --- a/usr.sbin/bgpd/log.c +++ b/usr.sbin/bgpd/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.21 2004/01/22 21:09:00 henning Exp $ */ +/* $OpenBSD: log.c,v 1.22 2004/01/23 21:17:51 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -381,3 +381,13 @@ log_ntoa(in_addr_t ip) ina.s_addr = ip; return (inet_ntoa(ina)); } + +char * +log_addr(struct bgpd_addr *addr) { + switch (addr->af) { + case AF_INET: + return (inet_ntoa(addr->v4)); + default: + return ("(unknown address family)"); + } +} |