bgpd: make bgp_nlri_parse_encap conform with other nlri_parse funcs
* bgp_encap.{c,h} (bgp_nlri_parse_encap) afi is already in the NLRI argument.
update or withdraw is signalled by attr being non-NULL or NULL.
* bgp_packet.c: (update_receive) fixup to match, and also make the attr
argument conform with NLRI_ATTR_ARG for correct error handling on
optional, transitive, partial, attributes.
diff --git a/bgpd/bgp_encap.c b/bgpd/bgp_encap.c
index d0beb1b..1a09ba6 100644
--- a/bgpd/bgp_encap.c
+++ b/bgpd/bgp_encap.c
@@ -126,14 +126,13 @@
int
bgp_nlri_parse_encap(
- afi_t afi,
struct peer *peer,
struct attr *attr, /* Need even for withdraw */
- struct bgp_nlri *packet,
- int withdraw) /* 0=update, !0 = withdraw */
+ struct bgp_nlri *packet)
{
u_char *pnt;
u_char *lim;
+ afi_t afi = packet->afi;
struct prefix p;
int psize = 0;
int prefixlen;
@@ -227,7 +226,7 @@
inet_ntop (p.family, &p.u.prefix, buf, BUFSIZ),
p.prefixlen);
- if (!withdraw) {
+ if (attr) {
bgp_update (peer, &p, attr, afi, SAFI_ENCAP,
ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, NULL, 0);
} else {