diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2010-05-04 10:25:32 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2010-05-04 10:25:32 +0000 |
commit | c768edd1ac0da60c8eb8aedc8ad92d7cd05de470 (patch) | |
tree | c4b4611ebc6ec758c7d13f4eaa6b834a5700f907 /usr.sbin/bgpd | |
parent | adb059c9ae28c780442dc5d144cabddb51bde3d5 (diff) |
Assuming that a prefixlen 32 is a host route is not clever when IPv6 comes
into play. Check the AID and use 32 or 128 based on the address family.
Now bgpctl show rib <IPv6 addr> works like in the IPv4 case.
Bug reported and fix made during yesterday's Swinog BE#85
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r-- | usr.sbin/bgpd/rde.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c index b0f72396a81..0f9cd241a11 100644 --- a/usr.sbin/bgpd/rde.c +++ b/usr.sbin/bgpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.292 2010/05/03 13:09:38 claudio Exp $ */ +/* $OpenBSD: rde.c,v 1.293 2010/05/04 10:25:31 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -2121,6 +2121,7 @@ rde_dump_ctx_new(struct ctl_show_rib_request *req, pid_t pid, struct rib_entry *re; u_int error; u_int16_t id; + u_int8_t hostplen; if ((ctx = calloc(1, sizeof(*ctx))) == NULL) { log_warn("rde_dump_ctx_new"); @@ -2157,7 +2158,18 @@ rde_dump_ctx_new(struct ctl_show_rib_request *req, pid_t pid, ctx->ribctx.ctx_upcall = rde_dump_prefix_upcall; break; } - if (req->prefixlen == 32) + switch (req->prefix.aid) { + case AID_INET: + case AID_VPN_IPv4: + hostplen = 32; + break; + case AID_INET6: + hostplen = 128; + break; + default: + fatalx("rde_dump_ctx_new: unknown af"); + } + if (req->prefixlen == hostplen) re = rib_lookup(&ribs[id], &req->prefix); else re = rib_get(&ribs[id], &req->prefix, req->prefixlen); |