diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2004-08-10 13:46:29 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2004-08-10 13:46:29 +0000 |
commit | 50d1185e794dd49188d19226b8cb6912cec5c979 (patch) | |
tree | efe339c6b10668241679c8d6c1e3fb897530f14d /usr.sbin/bgpd | |
parent | 4cb4e5f12cb7a9f60fc9bd71232d918f06b57b53 (diff) |
Support IPv6 in message and state transition dumps. Table dumps still
unsupported. OK henning@
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r-- | usr.sbin/bgpd/mrt.c | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/usr.sbin/bgpd/mrt.c b/usr.sbin/bgpd/mrt.c index 0c9b369123c..e24b1c737ba 100644 --- a/usr.sbin/bgpd/mrt.c +++ b/usr.sbin/bgpd/mrt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mrt.c,v 1.39 2004/08/06 12:04:08 claudio Exp $ */ +/* $OpenBSD: mrt.c,v 1.40 2004/08/10 13:46:28 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> @@ -102,9 +102,23 @@ mrt_dump_bgp_msg(struct mrt *mrt, void *pkg, u_int16_t pkglen, DUMP_SHORT(buf, bgp->as); DUMP_SHORT(buf, peer->remote_as); DUMP_SHORT(buf, /* ifindex */ 0); - DUMP_SHORT(buf, AFI_IPv4); - DUMP_NLONG(buf, peer->local_addr.v4.s_addr); - DUMP_NLONG(buf, peer->remote_addr.v4.s_addr); + switch (peer->local_addr.af) { + case AF_INET: + DUMP_SHORT(buf, AFI_IPv4); + DUMP_NLONG(buf, peer->local_addr.v4.s_addr); + DUMP_NLONG(buf, peer->remote_addr.v4.s_addr); + break; + case AF_INET6: + DUMP_SHORT(buf, AFI_IPv6); + if (buf_add(buf, &peer->local_addr.v6, + sizeof(peer->local_addr.v6)) == -1 || + buf_add(buf, &peer->remote_addr.v6, + sizeof(peer->remote_addr.v6)) == -1) { + log_warnx("mrt_dump_bgp_msg: buf_add error"); + return (-1); + } + break; + } if (buf_add(buf, pkg, pkglen) == -1) { log_warnx("mrt_dump_bgp_msg: buf_add error"); @@ -140,9 +154,23 @@ mrt_dump_state(struct mrt *mrt, u_int16_t old_state, u_int16_t new_state, DUMP_SHORT(buf, bgp->as); DUMP_SHORT(buf, peer->remote_as); DUMP_SHORT(buf, /* ifindex */ 0); - DUMP_SHORT(buf, AFI_IPv4); - DUMP_NLONG(buf, peer->local_addr.v4.s_addr); - DUMP_NLONG(buf, peer->remote_addr.v4.s_addr); + switch (peer->local_addr.af) { + case AF_INET: + DUMP_SHORT(buf, AFI_IPv4); + DUMP_NLONG(buf, peer->local_addr.v4.s_addr); + DUMP_NLONG(buf, peer->remote_addr.v4.s_addr); + break; + case AF_INET6: + DUMP_SHORT(buf, AFI_IPv6); + if (buf_add(buf, &peer->local_addr.v6, + sizeof(peer->local_addr.v6)) == -1 || + buf_add(buf, &peer->remote_addr.v6, + sizeof(peer->remote_addr.v6)) == -1) { + log_warnx("mrt_dump_bgp_msg: buf_add error"); + return (-1); + } + break; + } DUMP_SHORT(buf, old_state); DUMP_SHORT(buf, new_state); |