bgpd: Make aspath_highest 4-byte compatible for private AS

* bgp_aspath.h: Add BGP_AS_IS_PRIVATE macro.
* bgp_aspath.c: (aspath_highest) use said macro to also ensure 4-byte private
  AS range is ignored in calculating highest public ASN.
  (aspath_private_as_check) consolidate to use said macro.

Note: Extracted from 'bgpd: Add replace-as option to remove-private-as'
by paul@jakma.org.
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c
index 8c87d17..3fd359c 100644
--- a/bgpd/bgp_aspath.c
+++ b/bgpd/bgp_aspath.c
@@ -475,9 +475,8 @@
   while (seg)
     {
       for (i = 0; i < seg->length; i++)
-        if (seg->as[i] > highest
-            && (seg->as[i] < BGP_PRIVATE_AS_MIN
-                || seg->as[i] > BGP_PRIVATE_AS_MAX))
+        if (seg->as[i] > highest 
+            && !BGP_AS_IS_PRIVATE(seg->as[i]))
 	  highest = seg->as[i];
       seg = seg->next;
     }
@@ -1280,10 +1279,7 @@
       
       for (i = 0; i < seg->length; i++)
 	{
-	  if ( (seg->as[i] < BGP_PRIVATE_AS_MIN)
-	      || (seg->as[i] > BGP_PRIVATE_AS_MAX &&
-                  seg->as[i] < BGP_PRIVATE_AS4_MIN)
-               || (seg->as[i] > BGP_PRIVATE_AS4_MAX))
+	  if (!BGP_AS_IS_PRIVATE(seg->as[i]))
 	    return 0;
 	}
       seg = seg->next;
diff --git a/bgpd/bgp_aspath.h b/bgpd/bgp_aspath.h
index b467ee5..aa13daa 100644
--- a/bgpd/bgp_aspath.h
+++ b/bgpd/bgp_aspath.h
@@ -41,6 +41,10 @@
 /* Transition 16Bit AS as defined by IANA */
 #define BGP_AS_TRANS		 23456U
 
+#define BGP_AS_IS_PRIVATE(ASN) \
+    (((ASN) >= BGP_PRIVATE_AS_MIN && (ASN) <= BGP_PRIVATE_AS_MAX) || \
+     ((ASN) >= BGP_PRIVATE_AS4_MIN && (ASN) <= BGP_PRIVATE_AS4_MAX))
+
 /* AS_PATH segment data in abstracted form, no limit is placed on length */
 struct assegment
 {