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 {
diff --git a/bgpd/bgp_encap.h b/bgpd/bgp_encap.h
index 6f43b7b..7442c73 100644
--- a/bgpd/bgp_encap.h
+++ b/bgpd/bgp_encap.h
@@ -23,12 +23,7 @@
 #define _QUAGGA_BGP_ENCAP_H
 
 extern void bgp_encap_init (void);
-extern int bgp_nlri_parse_encap (
-    afi_t,
-    struct peer *,
-    struct attr *,
-    struct bgp_nlri *,
-    int withdraw);
+extern int bgp_nlri_parse_encap (struct peer *, struct attr *, struct bgp_nlri *);
 
 #include "bgp_encap_types.h"
 #endif /* _QUAGGA_BGP_ENCAP_H */
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 26e4d8f..b8a38fa 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -1943,12 +1943,12 @@
       if (mp_update.length
 	  && mp_update.afi == AFI_IP
 	  && mp_update.safi == SAFI_ENCAP)
-	bgp_nlri_parse_encap (mp_update.afi, peer, &attr, &mp_update, 0);
+	bgp_nlri_parse_encap (peer, NLRI_ATTR_ARG, &mp_update);
 
       if (mp_withdraw.length
 	  && mp_withdraw.afi == AFI_IP
 	  && mp_withdraw.safi == SAFI_ENCAP)
-	bgp_nlri_parse_encap (mp_withdraw.afi, peer, &attr, &mp_withdraw, 1);
+	bgp_nlri_parse_encap (peer, NULL, &mp_withdraw);
 
       if (! withdraw_len
 	  && mp_withdraw.afi == AFI_IP
@@ -1967,12 +1967,12 @@
       if (mp_update.length 
 	  && mp_update.afi == AFI_IP6 
 	  && mp_update.safi == SAFI_ENCAP)
-	bgp_nlri_parse_encap (mp_update.afi, peer, &attr, &mp_update, 0);
+	bgp_nlri_parse_encap (peer, NLRI_ATTR_ARG, &mp_update);
 
       if (mp_withdraw.length 
 	  && mp_withdraw.afi == AFI_IP6
 	  && mp_withdraw.safi == SAFI_ENCAP)
-	bgp_nlri_parse_encap (mp_withdraw.afi, peer, &attr, &mp_withdraw, 1);
+	bgp_nlri_parse_encap (peer, NULL, &mp_withdraw);
 
       if (! withdraw_len
 	  && mp_withdraw.afi == AFI_IP6