diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2005-06-06 17:13:57 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2005-06-06 17:13:57 +0000 |
commit | cbaf44da3b32495f202def87c3a418f9d49905c2 (patch) | |
tree | 1e6bcda421f7363453bfcc9e5e9f26985849b04f /usr.sbin/bgpctl | |
parent | 17f116c53e1d9f54d357ac1b02356d8c044ce112 (diff) |
add support for a "family" token, allows to select address families
Diffstat (limited to 'usr.sbin/bgpctl')
-rw-r--r-- | usr.sbin/bgpctl/parser.c | 22 | ||||
-rw-r--r-- | usr.sbin/bgpctl/parser.h | 3 |
2 files changed, 22 insertions, 3 deletions
diff --git a/usr.sbin/bgpctl/parser.c b/usr.sbin/bgpctl/parser.c index dfee340615e..fce51dd1c53 100644 --- a/usr.sbin/bgpctl/parser.c +++ b/usr.sbin/bgpctl/parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.c,v 1.14 2005/06/05 00:23:23 henning Exp $ */ +/* $OpenBSD: parser.c,v 1.15 2005/06/06 17:13:56 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -42,7 +42,8 @@ enum token_type { PFTABLE, PREPNBR, PREPSELF, - WEIGHT + WEIGHT, + FAMILY }; struct token { @@ -103,6 +104,7 @@ static const struct token t_show_fib[] = { { FLAG, "static", F_STATIC, t_show_fib}, { FLAG, "bgp", F_BGPD_INSERTED, t_show_fib}, { FLAG, "nexthop", F_NEXTHOP, t_show_fib}, + { FAMILY, "", NONE, t_show_fib}, { ADDRESS, "", NONE, NULL}, { ENDTOKEN, "", NONE, NULL} }; @@ -317,6 +319,20 @@ match_token(const char *word, const struct token table[]) res.flags |= t->value; } break; + case FAMILY: + if (word == NULL) + break; + if (!strcmp(word, "inet") || !strcmp(word, "IPv4")) { + match++; + t = &table[i]; + res.af = AF_INET; + } + if (!strcmp(word, "inet6") || !strcmp(word, "IPv6")) { + match++; + t = &table[i]; + res.af = AF_INET6; + } + break; case ADDRESS: if (parse_addr(word, &res.addr)) { match++; @@ -459,6 +475,8 @@ show_valid_args(const struct token table[]) case PFTABLE: fprintf(stderr, " <pftable>\n"); break; + case FAMILY: + fprintf(stderr, " [ inet | inet6 | IPv4 | IPv6 ]\n"); case ENDTOKEN: break; } diff --git a/usr.sbin/bgpctl/parser.h b/usr.sbin/bgpctl/parser.h index 87b0aab439a..043eebea9a1 100644 --- a/usr.sbin/bgpctl/parser.h +++ b/usr.sbin/bgpctl/parser.h @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.h,v 1.8 2005/05/23 20:09:00 claudio Exp $ */ +/* $OpenBSD: parser.h,v 1.9 2005/06/06 17:13:56 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -52,6 +52,7 @@ struct parse_result { int flags; u_int8_t prefixlen; struct filter_set_head set; + sa_family_t af; }; struct parse_result *parse(int, char *[]); |