From e8fe3cb5a7a056d320a8f018599e03c17edd5d1a Mon Sep 17 00:00:00 2001 From: Claudio Jeker Date: Tue, 1 Nov 2005 21:42:59 +0000 Subject: Sort filter_set with equal type as well. This affects community attributes and set nexthop. Now the full filter set list is sorted. --- usr.sbin/bgpd/parse.y | 28 ++++++++++++++++++++++++++-- 1 file 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 @@ -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); -- cgit v1.2.3