diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2018-09-14 10:22:12 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2018-09-14 10:22:12 +0000 |
commit | ac78a977e9da803b9b9844ef08d016387e515260 (patch) | |
tree | 15f746b0a44666baadbb4fb6ffee1c8aec1d7b89 /usr.sbin/bgpd/parse.y | |
parent | 2d09188661f3572b182b4384b2a6af4aa4cab5eb (diff) |
Extend as_set to allow for different sized objects to be added. The only
requirement is that the first value of the struct is a 32bit ID which is
used in the bsearch. This allows to add more than just as numbers to a
set. as_set_match now returns a pointer to this data or NULL if not found.
OK benno@
Diffstat (limited to 'usr.sbin/bgpd/parse.y')
-rw-r--r-- | usr.sbin/bgpd/parse.y | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index 2a4fcd5595e..4c4fec3ad1a 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.352 2018/09/13 11:18:18 claudio Exp $ */ +/* $OpenBSD: parse.y,v 1.353 2018/09/14 10:22:11 claudio Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -403,15 +403,19 @@ include : INCLUDE STRING { ; as_set : ASSET STRING '{' optnl { - if (new_as_set($2) != 0) + if (new_as_set($2) != 0) { + free($2); YYERROR; + } free($2); } as_set_l optnl '}' { done_as_set(); } | ASSET STRING '{' optnl '}' { - if (new_as_set($2) != 0) + if (new_as_set($2) != 0) { + free($2); YYERROR; + } free($2); } @@ -4179,7 +4183,7 @@ new_as_set(char *name) return -1; } - aset = as_set_new(name, 0); + aset = as_set_new(name, 0, sizeof(u_int32_t)); if (aset == NULL) fatal(NULL); as_sets_insert(conf->as_sets, aset); |