diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-07-04 09:37:25 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-07-04 09:37:25 +0000 |
commit | f6e3dc46fa21e24a0e4177cda73a98b9344061e9 (patch) | |
tree | 32fcfab11ef18fa73dff5f60231d4d4165399559 /usr.sbin/bgpd/parse.y | |
parent | da7d23f60156d4ceaef9ba166e80a01a7fde2ab3 (diff) |
New function filterset_cmp() used two compare two struct filter_set for
equality. This function is a bit more complicated than a memcmp() because there
are types that need to be considered equal e.g. ACTION_SET_MED and
ACTION_SET_RELATIVE_MED. Also ACTION_SET_COMMUNITY and ACTION_SET_NEXTHOP
need some special care. OK henning@
Diffstat (limited to 'usr.sbin/bgpd/parse.y')
-rw-r--r-- | usr.sbin/bgpd/parse.y | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index 1aebab4c54b..222ab74af37 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.167 2005/07/04 09:31:35 claudio Exp $ */ +/* $OpenBSD: parse.y,v 1.168 2005/07/04 09:37:24 claudio Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -2247,24 +2247,12 @@ merge_filterset(struct filter_set_head *sh, struct filter_set *s) struct filter_set *t; TAILQ_FOREACH(t, sh, entry) { - if (s->type != t->type) - continue; - - switch (s->type) { - case ACTION_SET_COMMUNITY: - if (s->action.community.as == t->action.community.as && - s->action.community.type == - t->action.community.type) { + if (filterset_cmp(s, t) == 0) { + if (s->type == ACTION_SET_COMMUNITY) yyerror("community is already set"); - return (-1); - } - break; - case ACTION_SET_NEXTHOP: - if (s->action.nexthop.af != t->action.nexthop.af) - break; - /* FALLTHROUGH */ - default: - yyerror("redefining set parameters is not fluffy"); + else + yyerror("redefining set parameter %s", + filterset_names[s->type]); return (-1); } } @@ -2272,7 +2260,6 @@ merge_filterset(struct filter_set_head *sh, struct filter_set *s) return (0); } - void copy_filterset(struct filter_set_head *source, struct filter_set_head *dest) { |