match from any large-community 1234:5678:1 large-community 1234:5678:2 large-community 1234:5678:3
match from any community 1234:1 large-community 1234:5678:1
match from any large-community 1234:5678:1 community 1234:1
-match from any set { community delete 1234:5678 community delete 1234:* community delete *:5678 community delete local-as:5678 community delete local-as:neighbor-as large-community delete 1234:15:5678 large-community delete *:15:5678 large-community delete local-as:15:5678 large-community delete local-as:15:* large-community delete local-as:15:neighbor-as large-community delete local-as:*:* community 1234:5678 community local-as:5678 community local-as:neighbor-as large-community 1234:15:5678 large-community local-as:15:5678 large-community local-as:15:neighbor-as }
+match from any set { community delete 1234:5678 large-community delete 1234:15:5678 community delete *:5678 large-community delete *:15:5678 community delete local-as:5678 large-community delete local-as:15:5678 community delete 1234:* community delete local-as:neighbor-as large-community delete local-as:15:* large-community delete local-as:*:* large-community delete local-as:15:neighbor-as community 1234:5678 large-community 1234:15:5678 community local-as:5678 large-community local-as:15:5678 community local-as:neighbor-as large-community local-as:15:neighbor-as }
match from any ext-community ovs not-found
match from any ext-community rt 64496:201 ext-community soo 64496:202
match from any ext-community rt 64496:301 ext-community soo 4200000001:302 ext-community odi 127.0.0.1:303
-match from any set { ext-community delete ovs valid ext-community delete odi 127.0.0.1:6003 ext-community delete soo 4200000001:6002 ext-community delete ort 0x123456789abf ext-community delete rt 64496:6001 ext-community ovs valid ext-community odi 127.0.0.1:5003 ext-community soo 4200000001:5002 ext-community ort 0x123456789abc ext-community rt 64496:5001 }
+match from any set { ext-community delete ovs valid ext-community delete ort 0x123456789abf ext-community delete rt 64496:6001 ext-community delete odi 127.0.0.1:6003 ext-community delete soo 4200000001:6002 ext-community ovs valid ext-community ort 0x123456789abc ext-community rt 64496:5001 ext-community odi 127.0.0.1:5003 ext-community soo 4200000001:5002 }
match from any ext-community * *
match from any ext-community rt *
match from any ext-community soo *
match from any ext-community soo 64496:*
match from any ext-community soo 4200000001:*
match from any ext-community soo 127.0.0.1:*
-match from any set { ext-community delete odi 127.0.0.1:* ext-community delete soo 4200000001:* ext-community delete rt 64496:* ext-community delete mac-mob * ext-community delete ovs * ext-community delete rt * ext-community delete soo * ext-community delete odi * ext-community delete ort * }
+match from any set { ext-community delete ort * ext-community delete mac-mob * ext-community delete ovs * ext-community delete rt * ext-community delete soo * ext-community delete odi * ext-community delete rt 64496:* ext-community delete odi 127.0.0.1:* ext-community delete soo 4200000001:* }
match from any ext-community rt 64496:local-as
match from any ext-community soo 4200000001:local-as
match from any ext-community odi 127.0.0.1:local-as
-/* $OpenBSD: parse.y,v 1.414 2021/03/02 09:45:07 claudio Exp $ */
+/* $OpenBSD: parse.y,v 1.415 2021/04/15 13:42:33 bluhm Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
return (NULL);
}
+static int
+cmpcommunity(struct community *a, struct community *b)
+{
+ if (a->flags > b->flags)
+ return 1;
+ if (a->flags < b->flags)
+ return -1;
+ if (a->data1 > b->data1)
+ return 1;
+ if (a->data1 < b->data1)
+ return -1;
+ if (a->data2 > b->data2)
+ return 1;
+ if (a->data2 < b->data2)
+ return -1;
+ if (a->data3 > b->data3)
+ return 1;
+ if (a->data3 < b->data3)
+ return -1;
+ return 0;
+}
+
static int
getcommunity(char *s, int large, u_int32_t *val, u_int32_t *flag)
{
switch (s->type) {
case ACTION_SET_COMMUNITY:
case ACTION_DEL_COMMUNITY:
- if (memcmp(&s->action.community,
- &t->action.community,
- sizeof(s->action.community)) < 0) {
+ switch (cmpcommunity(&s->action.community,
+ &t->action.community)) {
+ case -1:
TAILQ_INSERT_BEFORE(t, s, entry);
return;
- } else if (memcmp(&s->action.community,
- &t->action.community,
- sizeof(s->action.community)) == 0)
+ case 0:
break;
- continue;
+ case 1:
+ continue;
+ }
+ break;
case ACTION_SET_NEXTHOP:
/* only last nexthop per AF matters */
if (s->action.nexthop.aid <