aboutsummaryrefslogtreecommitdiff
path: root/net/openbgpd/files/patch-bgpctl_parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/openbgpd/files/patch-bgpctl_parser.c')
-rw-r--r--net/openbgpd/files/patch-bgpctl_parser.c118
1 files changed, 105 insertions, 13 deletions
diff --git a/net/openbgpd/files/patch-bgpctl_parser.c b/net/openbgpd/files/patch-bgpctl_parser.c
index 5efa4ce8cd49..237c6ffc9b92 100644
--- a/net/openbgpd/files/patch-bgpctl_parser.c
+++ b/net/openbgpd/files/patch-bgpctl_parser.c
@@ -2,10 +2,10 @@ Index: bgpctl/parser.c
===================================================================
RCS file: /home/cvs/private/hrs/openbgpd/bgpctl/parser.c,v
retrieving revision 1.1.1.6
-retrieving revision 1.5
-diff -u -p -r1.1.1.6 -r1.5
+retrieving revision 1.6
+diff -u -p -r1.1.1.6 -r1.6
--- bgpctl/parser.c 14 Feb 2010 20:20:14 -0000 1.1.1.6
-+++ bgpctl/parser.c 10 Apr 2010 12:17:18 -0000 1.5
++++ bgpctl/parser.c 2 Jul 2011 16:06:35 -0000 1.6
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.54 2009/06/12 16:44:02 claudio Exp $ */
+/* $OpenBSD: parser.c,v 1.61 2010/03/08 17:02:19 claudio Exp $ */
@@ -23,15 +23,27 @@ diff -u -p -r1.1.1.6 -r1.5
#include <sys/types.h>
#include <sys/socket.h>
-@@ -97,6 +101,7 @@ static const struct token t_prepself[];
+@@ -52,7 +56,8 @@ enum token_type {
+ PREPSELF,
+ WEIGHT,
+ FAMILY,
+- GETOPT
++ GETOPT,
++ RTABLE
+ };
+
+ enum getopts {
+@@ -97,6 +102,9 @@ static const struct token t_prepself[];
static const struct token t_weight[];
static const struct token t_irrfilter[];
static const struct token t_irrfilter_opts[];
+static const struct token t_log[];
++static const struct token t_fib_table[];
++static const struct token t_show_fib_table[];
static const struct token t_main[] = {
{ KEYWORD, "reload", RELOAD, NULL},
-@@ -105,6 +110,7 @@ static const struct token t_main[] = {
+@@ -105,6 +113,7 @@ static const struct token t_main[] = {
{ KEYWORD, "neighbor", NEIGHBOR, t_neighbor},
{ KEYWORD, "network", NONE, t_network},
{ KEYWORD, "irrfilter", IRRFILTER, t_irrfilter},
@@ -39,7 +51,47 @@ diff -u -p -r1.1.1.6 -r1.5
{ ENDTOKEN, "", NONE, NULL}
};
-@@ -311,6 +317,12 @@ static const struct token t_irrfilter_op
+@@ -116,6 +125,7 @@ static const struct token t_show[] = {
+ { KEYWORD, "network", NETWORK_SHOW, t_network_show},
+ { KEYWORD, "nexthop", SHOW_NEXTHOP, NULL},
+ { KEYWORD, "rib", SHOW_RIB, t_show_rib},
++ { KEYWORD, "tables", SHOW_FIB_TABLES, NULL},
+ { KEYWORD, "ip", NONE, t_show_ip},
+ { KEYWORD, "summary", SHOW_SUMMARY, t_show_summary},
+ { ENDTOKEN, "", NONE, NULL}
+@@ -128,14 +138,15 @@ static const struct token t_show_summary
+ };
+
+ static const struct token t_show_fib[] = {
+- { NOTOKEN, "", NONE, NULL},
+- { FLAG, "connected", F_CONNECTED, 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}
++ { NOTOKEN, "", NONE, NULL},
++ { FLAG, "connected", F_CONNECTED, 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},
++ { KEYWORD, "table", NONE, t_show_fib_table},
++ { FAMILY, "", NONE, t_show_fib},
++ { ADDRESS, "", NONE, NULL},
++ { ENDTOKEN, "", NONE, NULL}
+ };
+
+ static const struct token t_show_rib[] = {
+@@ -187,6 +198,7 @@ static const struct token t_show_neighbo
+ static const struct token t_fib[] = {
+ { KEYWORD, "couple", FIB_COUPLE, NULL},
+ { KEYWORD, "decouple", FIB_DECOUPLE, NULL},
++ { KEYWORD, "table", NONE, t_fib_table},
+ { ENDTOKEN, "", NONE, NULL}
+ };
+
+@@ -311,6 +323,22 @@ static const struct token t_irrfilter_op
{ ENDTOKEN, "", NONE, NULL}
};
@@ -49,10 +101,20 @@ diff -u -p -r1.1.1.6 -r1.5
+ { ENDTOKEN, "", NONE, NULL}
+};
+
++static const struct token t_fib_table[] = {
++ { RTABLE, "", NONE, t_fib},
++ { ENDTOKEN, "", NONE, NULL}
++};
++
++static const struct token t_show_fib_table[] = {
++ { RTABLE, "", NONE, t_show_fib},
++ { ENDTOKEN, "", NONE, NULL}
++};
++
static struct parse_result res;
const struct token *match_token(int *argc, char **argv[],
-@@ -404,15 +416,22 @@ match_token(int *argc, char **argv[], co
+@@ -404,15 +432,22 @@ match_token(int *argc, char **argv[], co
case FAMILY:
if (word == NULL)
break;
@@ -79,7 +141,25 @@ diff -u -p -r1.1.1.6 -r1.5
}
break;
case ADDRESS:
-@@ -584,7 +603,7 @@ show_valid_args(const struct token table
+@@ -485,6 +520,7 @@ match_token(int *argc, char **argv[], co
+ case PREPNBR:
+ case PREPSELF:
+ case WEIGHT:
++ case RTABLE:
+ if (word != NULL && strlen(word) > 0 &&
+ parse_number(word, &res, table[i].type)) {
+ match++;
+@@ -577,6 +613,9 @@ show_valid_args(const struct token table
+ case WEIGHT:
+ fprintf(stderr, " <number>\n");
+ break;
++ case RTABLE:
++ fprintf(stderr, " <rtableid>\n");
++ break;
+ case NEXTHOP:
+ fprintf(stderr, " <address>\n");
+ break;
+@@ -584,7 +623,7 @@ show_valid_args(const struct token table
fprintf(stderr, " <pftable>\n");
break;
case FAMILY:
@@ -88,7 +168,7 @@ diff -u -p -r1.1.1.6 -r1.5
break;
case GETOPT:
fprintf(stderr, " <options>\n");
-@@ -608,7 +627,7 @@ parse_addr(const char *word, struct bgpd
+@@ -608,7 +647,7 @@ parse_addr(const char *word, struct bgpd
bzero(&ina, sizeof(ina));
if (inet_net_pton(AF_INET, word, &ina, sizeof(ina)) != -1) {
@@ -97,7 +177,7 @@ diff -u -p -r1.1.1.6 -r1.5
addr->v4 = ina;
return (1);
}
-@@ -618,13 +637,7 @@ parse_addr(const char *word, struct bgpd
+@@ -618,13 +657,7 @@ parse_addr(const char *word, struct bgpd
hints.ai_socktype = SOCK_DGRAM; /*dummy*/
hints.ai_flags = AI_NUMERICHOST;
if (getaddrinfo(word, "0", &hints, &r) == 0) {
@@ -112,7 +192,7 @@ diff -u -p -r1.1.1.6 -r1.5
freeaddrinfo(r);
return (1);
}
-@@ -663,15 +676,15 @@ parse_prefix(const char *word, struct bg
+@@ -663,15 +696,15 @@ parse_prefix(const char *word, struct bg
if (parse_addr(word, addr) == 0)
return (0);
@@ -131,7 +211,7 @@ diff -u -p -r1.1.1.6 -r1.5
if (mask == -1)
mask = 128;
inet6applymask(&addr->v6, &addr->v6, mask);
-@@ -706,7 +719,7 @@ parse_asnum(const char *word, u_int32_t
+@@ -706,7 +739,7 @@ parse_asnum(const char *word, u_int32_t
if (errstr)
errx(1, "AS number is %s: %s", errstr, word);
} else {
@@ -140,7 +220,19 @@ diff -u -p -r1.1.1.6 -r1.5
if (errstr)
errx(1, "AS number is %s: %s", errstr, word);
}
-@@ -882,8 +895,14 @@ bgpctl_getopt(int *argc, char **argv[],
+@@ -730,6 +763,11 @@ parse_number(const char *word, struct pa
+ errx(1, "number is %s: %s", errstr, word);
+
+ /* number was parseable */
++ if (type == RTABLE) {
++ r->rtableid = uval;
++ return (1);
++ }
++
+ if ((fs = calloc(1, sizeof(struct filter_set))) == NULL)
+ err(1, NULL);
+ switch (type) {
+@@ -882,8 +920,14 @@ bgpctl_getopt(int *argc, char **argv[],
int ch;
optind = optreset = 1;