summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2010-01-10 00:16:24 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2010-01-10 00:16:24 +0000
commitd1c662a8844fdccea09098f826cfdfe7d39faa9c (patch)
tree2cd4c29adecc1294b5bcb842b2ed12fe64cd2ad0
parentb2753e61513c65622a1dc634dafb402669ee2905 (diff)
ribreq uses now a AID, use AID also on the parsing side and convert to
AF when necessary. OK henning@
-rw-r--r--usr.sbin/bgpctl/bgpctl.c12
-rw-r--r--usr.sbin/bgpctl/parser.c6
-rw-r--r--usr.sbin/bgpctl/parser.h4
3 files changed, 12 insertions, 10 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c
index cbfda5deee2..77e4f2dbb5e 100644
--- a/usr.sbin/bgpctl/bgpctl.c
+++ b/usr.sbin/bgpctl/bgpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpctl.c,v 1.154 2009/12/16 15:42:19 claudio Exp $ */
+/* $OpenBSD: bgpctl.c,v 1.155 2010/01/10 00:16:23 claudio Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -165,13 +165,15 @@ main(int argc, char *argv[])
case SHOW_FIB:
if (!res->addr.aid) {
struct buf *msg;
+ sa_family_t af;
+ af = aid2af(res->aid);
if ((msg = imsg_create(ibuf, IMSG_CTL_KROUTE, 0, 0,
- sizeof(res->flags) + sizeof(res->af))) == NULL)
+ sizeof(res->flags) + sizeof(af))) == NULL)
errx(1, "imsg_create failure");
if (imsg_add(msg, &res->flags, sizeof(res->flags)) ==
-1 ||
- imsg_add(msg, &res->af, sizeof(res->af)) == -1)
+ imsg_add(msg, &af, sizeof(af)) == -1)
errx(1, "imsg_add failure");
imsg_close(ibuf, msg);
} else
@@ -219,7 +221,7 @@ main(int argc, char *argv[])
memcpy(&ribreq.neighbor, &neighbor,
sizeof(ribreq.neighbor));
strlcpy(ribreq.rib, res->rib, sizeof(ribreq.rib));
- ribreq.af = res->af;
+ ribreq.aid = res->aid;
ribreq.flags = res->flags;
imsg_compose(ibuf, type, 0, 0, -1, &ribreq, sizeof(ribreq));
if (!(res->flags & F_CTL_DETAIL))
@@ -289,7 +291,7 @@ main(int argc, char *argv[])
break;
case NETWORK_SHOW:
bzero(&ribreq, sizeof(ribreq));
- ribreq.af = res->af;
+ ribreq.aid = res->aid;
strlcpy(ribreq.rib, res->rib, sizeof(ribreq.rib));
imsg_compose(ibuf, IMSG_CTL_SHOW_NETWORK, 0, 0, -1,
&ribreq, sizeof(ribreq));
diff --git a/usr.sbin/bgpctl/parser.c b/usr.sbin/bgpctl/parser.c
index 29d69dfbcf9..335f3f53883 100644
--- a/usr.sbin/bgpctl/parser.c
+++ b/usr.sbin/bgpctl/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.58 2009/12/01 14:29:40 claudio Exp $ */
+/* $OpenBSD: parser.c,v 1.59 2010/01/10 00:16:23 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -416,12 +416,12 @@ match_token(int *argc, char **argv[], const struct token table[])
if (!strcmp(word, "inet") || !strcmp(word, "IPv4")) {
match++;
t = &table[i];
- res.af = AF_INET;
+ res.aid = AID_INET;
}
if (!strcmp(word, "inet6") || !strcmp(word, "IPv6")) {
match++;
t = &table[i];
- res.af = AF_INET6;
+ res.aid = AID_INET6;
}
break;
case ADDRESS:
diff --git a/usr.sbin/bgpctl/parser.h b/usr.sbin/bgpctl/parser.h
index 6ce3943fa92..2b7da598a32 100644
--- a/usr.sbin/bgpctl/parser.h
+++ b/usr.sbin/bgpctl/parser.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.h,v 1.20 2009/11/02 20:38:45 claudio Exp $ */
+/* $OpenBSD: parser.h,v 1.21 2010/01/10 00:16:23 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -63,7 +63,7 @@ struct parse_result {
int flags;
enum actions action;
u_int8_t prefixlen;
- sa_family_t af;
+ u_int8_t aid;
};
__dead void usage(void);