On Fri, Aug 29, 2008 at 08:24:06PM -0700, Greg Skinner wrote:
> Seems like given this RIB entry:
>
> % ./bgpctl show rib detail 10.0.0.0
> BGP routing table entry for 10.0.0.0/24
> 1.0
> Nexthop 192.168.219.19 (via 192.168.219.19) from test (192.168.0.1)
> Origin IGP, metric 0, localpref 100, external, valid, best
> Last update: 03:20:38 ago
> Communities: 7:7 NO_ADVERTISE
>
> it should be possible to do this:
>
> % ./bgpctl show rib community no_advertise
> Invalid community
> unknown argument: no_advertise
> valid commands/args:
> <community>
>
> There is some code in parse_community() that sets the value of "as" to
> COMMUNITY_WELLKNOWN, which is also the value of USHRT_MAX, which
> guarantees that the test will fail:
>
> done:
> if (as == 0 || as == USHRT_MAX) {
> fprintf(stderr, "Invalid community\n");
> return (0);
> }
> if (as == COMMUNITY_WELLKNOWN)
> switch (type) {
> case COMMUNITY_NO_EXPORT:
> case COMMUNITY_NO_ADVERTISE:
> case COMMUNITY_NO_EXPSUBCONFED:
> /* valid */
> break;
> default:
> /* unknown */
> fprintf(stderr, "Invalid well-known community\n");
> return (0);
> }
>
Yep, the first check is wrong. I fixed it now in -current. Thanks for the
report.
--
:wq Claudio