Apply by doing:
	cd /usr/src
	patch -p0 < 001_bgpd.patch

And then rebuild and install bgpd:
	cd usr.sbin/bgpd/
	make obj
	make depend
	make 
	make install

Index: usr.sbin/bgpd/rde.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde.c,v
retrieving revision 1.316
retrieving revision 1.316.2.1
diff -u -r1.316 -r1.316.2.1
--- usr.sbin/bgpd/rde.c	27 May 2012 18:52:07 -0000	1.316
+++ usr.sbin/bgpd/rde.c	29 Nov 2012 20:06:16 -0000	1.316.2.1
@@ -1382,7 +1382,7 @@
 	} while (0)
 
 #define CHECK_FLAGS(s, t, m)	\
-	(((s) & ~(ATTR_EXTLEN | (m))) == (t))
+	(((s) & ~(ATTR_DEFMASK | (m))) == (t))
 
 int
 rde_attr_parse(u_char *p, u_int16_t len, struct rde_peer *peer,
Index: usr.sbin/bgpd/rde.h
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde.h,v
retrieving revision 1.142
retrieving revision 1.142.4.1
diff -u -r1.142 -r1.142.4.1
--- usr.sbin/bgpd/rde.h	21 Sep 2011 08:59:01 -0000	1.142
+++ usr.sbin/bgpd/rde.h	29 Nov 2012 20:06:16 -0000	1.142.4.1
@@ -118,6 +118,9 @@
 #define ATTR_PARTIAL		0x20
 #define ATTR_TRANSITIVE		0x40
 #define ATTR_OPTIONAL		0x80
+#define ATTR_RESERVED		0x0f
+/* by default mask the reserved bits and the ext len bit */
+#define ATTR_DEFMASK		(ATTR_RESERVED | ATTR_EXTLEN)
 
 /* default attribute flags for well known attributes */
 #define ATTR_WELL_KNOWN		ATTR_TRANSITIVE
Index: usr.sbin/bgpd/rde_attr.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde_attr.c,v
retrieving revision 1.90
retrieving revision 1.90.2.1
diff -u -r1.90 -r1.90.2.1
--- usr.sbin/bgpd/rde_attr.c	12 Apr 2012 17:27:20 -0000	1.90
+++ usr.sbin/bgpd/rde_attr.c	29 Nov 2012 20:06:16 -0000	1.90.2.1
@@ -37,12 +37,12 @@
 	u_char		*b = p;
 	u_int16_t	 tmp, tot_len = 2; /* attribute header (without len) */
 
+	flags &= ~ATTR_DEFMASK;
 	if (data_len > 255) {
 		tot_len += 2 + data_len;
 		flags |= ATTR_EXTLEN;
 	} else {
 		tot_len += 1 + data_len;
-		flags &= ~ATTR_EXTLEN;
 	}
 
 	if (tot_len > p_len)
@@ -69,12 +69,12 @@
 {
 	u_char	hdr[4];
 
+	flags &= ~ATTR_DEFMASK;
 	if (data_len > 255) {
 		flags |= ATTR_EXTLEN;
 		hdr[2] = (data_len >> 8) & 0xff;
 		hdr[3] = data_len & 0xff;
 	} else {
-		flags &= ~ATTR_EXTLEN;
 		hdr[2] = data_len & 0xff;
 	}
 
@@ -322,6 +322,7 @@
 		fatal("attr_optadd");
 	rdemem.attr_cnt++;
 
+	flags &= ~ATTR_DEFMASK;	/* normalize mask */
 	a->flags = flags;
 	a->hash = hash32_buf(&flags, sizeof(flags), HASHINIT);
 	a->type = type;
@@ -351,6 +352,7 @@
 	struct attr		*a;
 	u_int32_t		 hash;
 
+	flags &= ~ATTR_DEFMASK;	/* normalize mask */
 	hash = hash32_buf(&flags, sizeof(flags), HASHINIT);
 	hash = hash32_buf(&type, sizeof(type), hash);
 	hash = hash32_buf(&len, sizeof(len), hash);

