diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-11-01 21:42:59 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-11-01 21:42:59 +0000 |
commit | e8fe3cb5a7a056d320a8f018599e03c17edd5d1a (patch) | |
tree | b37b2c913c4de283a914f5e1507071dd1df01899 | |
parent | bb87063d4df017a5236b81e051e837d3fb05f295 (diff) |
Sort filter_set with equal type as well. This affects community
attributes and set nexthop. Now the full filter set list is sorted.
-rw-r--r-- | usr.sbin/bgpd/parse.y | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index 37de5827591..c03d0b052f1 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.175 2005/11/01 18:11:24 claudio Exp $ */ +/* $OpenBSD: parse.y,v 1.176 2005/11/01 21:42:58 claudio Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -2377,11 +2377,35 @@ merge_filterset(struct filter_set_head *sh, struct filter_set *s) } } - TAILQ_FOREACH(t, sh, entry) + TAILQ_FOREACH(t, sh, entry) { if (s->type < t->type) { TAILQ_INSERT_BEFORE(t, s, entry); return (0); } + if (s->type == t->type) + switch (s->type) { + case ACTION_SET_COMMUNITY: + if (s->action.community.as < + t->action.community.as || + (s->action.community.as == + t->action.community.as && + s->action.community.type < + t->action.community.type)) { + TAILQ_INSERT_BEFORE(t, s, entry); + return (0); + } + break; + case ACTION_SET_NEXTHOP: + if (s->action.nexthop.af < + t->action.nexthop.af) { + TAILQ_INSERT_BEFORE(t, s, entry); + return (0); + } + break; + default: + break; + } + } TAILQ_INSERT_TAIL(sh, s, entry); return (0); |