Hi,
I noticed that multiple functions from OpenBGPd declared an argument "u_int16_t
neighas" that is never used.
Here is a patch to remove it.
Denis
Index: parse.y
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/parse.y,v
retrieving revision 1.286
diff -u -p -r1.286 parse.y
--- parse.y 27 Oct 2015 18:19:33 -0000 1.286
+++ parse.y 27 Mar 2016 16:22:42 -0000
@@ -783,7 +783,7 @@ rdomainopts : RD STRING {
* RD is almost encode like an ext-community,
* but only almost so convert here.
*/
- if (community_ext_conv(&ext, 0, &rd)) {
+ if (community_ext_conv(&ext, &rd)) {
yyerror("bad encoding of rd");
YYERROR;
}
Index: rde.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde.c,v
retrieving revision 1.345
diff -u -p -r1.345 rde.c
--- rde.c 22 Dec 2015 21:36:57 -0000 1.345
+++ rde.c 27 Mar 2016 16:22:43 -0000
@@ -2429,7 +2429,7 @@ rde_rdomain_import(struct rde_aspath *as
struct filter_set *s;
TAILQ_FOREACH(s, &rd->import, entry) {
- if (community_ext_match(asp, &s->action.ext_community, 0))
+ if (community_ext_match(asp, &s->action.ext_community))
return (1);
}
return (0);
Index: rde.h
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde.h,v
retrieving revision 1.149
diff -u -p -r1.149 rde.h
--- rde.h 6 Nov 2015 16:23:26 -0000 1.149
+++ rde.h 27 Mar 2016 16:22:43 -0000
@@ -368,13 +368,12 @@ int community_match(struct rde_aspath
int community_set(struct rde_aspath *, int, int);
void community_delete(struct rde_aspath *, int, int);
int community_ext_match(struct rde_aspath *,
- struct filter_extcommunity *, u_int16_t);
+ struct filter_extcommunity *);
int community_ext_set(struct rde_aspath *,
- struct filter_extcommunity *, u_int16_t);
+ struct filter_extcommunity *);
void community_ext_delete(struct rde_aspath *,
- struct filter_extcommunity *, u_int16_t);
-int community_ext_conv(struct filter_extcommunity *, u_int16_t,
- u_int64_t *);
+ struct filter_extcommunity *);
+int community_ext_conv(struct filter_extcommunity *, u_int64_t *);
/* rde_decide.c */
void prefix_evaluate(struct prefix *, struct rib_entry *);
Index: rde_attr.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde_attr.c,v
retrieving revision 1.95
diff -u -p -r1.95 rde_attr.c
--- rde_attr.c 24 Oct 2015 08:00:42 -0000 1.95
+++ rde_attr.c 27 Mar 2016 16:22:44 -0000
@@ -971,7 +971,7 @@ aspath_lenmatch(struct aspath *a, enum a
* Functions handling communities and extended communities.
*/
-int community_ext_matchone(struct filter_extcommunity *, u_int16_t, u_int64_t);
+int community_ext_matchone(struct filter_extcommunity *, u_int64_t);
int
community_match(struct rde_aspath *asp, int as, int type)
@@ -1112,8 +1112,7 @@ community_delete(struct rde_aspath *asp,
}
int
-community_ext_match(struct rde_aspath *asp, struct filter_extcommunity *c,
- u_int16_t neighas)
+community_ext_match(struct rde_aspath *asp, struct filter_extcommunity *c)
{
struct attr *attr;
u_int8_t *p;
@@ -1128,7 +1127,7 @@ community_ext_match(struct rde_aspath *a
p = attr->data;
for (len = attr->len / sizeof(ec); len > 0; len--) {
memcpy(&ec, p, sizeof(ec));
- if (community_ext_matchone(c, neighas, ec))
+ if (community_ext_matchone(c, ec))
return (1);
p += sizeof(ec);
}
@@ -1137,8 +1136,7 @@ community_ext_match(struct rde_aspath *a
}
int
-community_ext_set(struct rde_aspath *asp, struct filter_extcommunity *c,
- u_int16_t neighas)
+community_ext_set(struct rde_aspath *asp, struct filter_extcommunity *c)
{
struct attr *attr;
u_int8_t *p = NULL;
@@ -1146,7 +1144,7 @@ community_ext_set(struct rde_aspath *asp
unsigned int i, ncommunities = 0;
u_int8_t f = ATTR_OPTIONAL|ATTR_TRANSITIVE;
- if (community_ext_conv(c, neighas, &community))
+ if (community_ext_conv(c, &community))
return (0);
attr = attr_optget(asp, ATTR_EXT_COMMUNITIES);
@@ -1185,8 +1183,7 @@ community_ext_set(struct rde_aspath *asp
}
void
-community_ext_delete(struct rde_aspath *asp, struct filter_extcommunity *c,
- u_int16_t neighas)
+community_ext_delete(struct rde_aspath *asp, struct filter_extcommunity *c)
{
struct attr *attr;
u_int8_t *p, *n;
@@ -1194,7 +1191,7 @@ community_ext_delete(struct rde_aspath *
u_int16_t l, len = 0;
u_int8_t f;
- if (community_ext_conv(c, neighas, &community))
+ if (community_ext_conv(c, &community))
return;
attr = attr_optget(asp, ATTR_EXT_COMMUNITIES);
@@ -1236,8 +1233,7 @@ community_ext_delete(struct rde_aspath *
}
int
-community_ext_conv(struct filter_extcommunity *c, u_int16_t neighas,
- u_int64_t *community)
+community_ext_conv(struct filter_extcommunity *c, u_int64_t *community)
{
u_int64_t com;
u_int32_t ip;
@@ -1275,8 +1271,7 @@ community_ext_conv(struct filter_extcomm
}
int
-community_ext_matchone(struct filter_extcommunity *c, u_int16_t neighas,
- u_int64_t community)
+community_ext_matchone(struct filter_extcommunity *c, u_int64_t community)
{
u_int64_t com, mask;
u_int32_t ip;
Index: rde_filter.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde_filter.c,v
retrieving revision 1.76
diff -u -p -r1.76 rde_filter.c
--- rde_filter.c 6 Nov 2015 16:23:26 -0000 1.76
+++ rde_filter.c 27 Mar 2016 16:22:44 -0000
@@ -205,12 +205,10 @@ rde_apply_set(struct rde_aspath *asp, st
asp->origin = set->action.origin;
break;
case ACTION_SET_EXT_COMMUNITY:
- community_ext_set(asp, &set->action.ext_community,
- peer->conf.remote_as);
+ community_ext_set(asp, &set->action.ext_community);
break;
case ACTION_DEL_EXT_COMMUNITY:
- community_ext_delete(asp, &set->action.ext_community,
- peer->conf.remote_as);
+ community_ext_delete(asp, &set->action.ext_community);
break;
}
}
@@ -267,8 +265,7 @@ rde_filter_match(struct filter_rule *f,
}
if (asp != NULL &&
(f->match.ext_community.flags & EXT_COMMUNITY_FLAG_VALID))
- if (community_ext_match(asp, &f->match.ext_community,
- peer->conf.remote_as) == 0)
+ if (community_ext_match(asp, &f->match.ext_community) == 0)
return (0);
if (f->match.prefix.addr.aid != 0) {