]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Minor cleanups
authorOndrej Zajicek (work) <santiago@crfreenet.org>
Tue, 14 Mar 2017 16:18:50 +0000 (17:18 +0100)
committerOndrej Zajicek (work) <santiago@crfreenet.org>
Tue, 14 Mar 2017 16:25:42 +0000 (17:25 +0100)
BTW, 'prefices' is hypercorrection, as 'prefix' is from 'praefixum' with
plural 'praefixa'.

doc/bird.sgml
filter/filter.c
lib/net.c

index e85ebf183df7141240160fa2257daf7a48af04f5..761c5396c92af99887200b22d59104298e817ae2 100644 (file)
@@ -1196,27 +1196,29 @@ foot).
        This type can hold a network prefix consisting of IP address, prefix
        length and several other values. This is the key in route tables.
 
-       Prefices may be of several types, which can be determined by the special
-       operator <cf/.type/ of type <m/enum/. The type may be:
+       Prefixes may be of several types, which can be determined by the special
+       operator <cf/.type/. The type may be:
 
-       <cf/NET_IP4/ and <cf/NET_IP6/ prefices hold an IP prefix. The literals are 
-       written as <cf><m/ipaddress//<m/pxlen/</cf>,
+       <cf/NET_IP4/ and <cf/NET_IP6/ prefixes hold an IP prefix. The literals
+       are written as <cf><m/ipaddress//<m/pxlen/</cf>,
        or <cf><m>ipaddress</m>/<m>netmask</m></cf>. There are two special
-       operators on IP prefices: <cf/.ip/ which extracts the IP address from the
-       pair, and <cf/.len/, which separates prefix length from the pair.
+       operators on IP prefixes: <cf/.ip/ which extracts the IP address from
+       the pair, and <cf/.len/, which separates prefix length from the pair.
        So <cf>1.2.0.0/16.len = 16</cf> is true.
 
-       <cf/NET_VPN4/ and <cf/NET_VPN6/ prefices hold an IP prefix with
-       VPN Route Distinguisher (<rfc id="4364">). They support the same special
-       operators as IP prefices, and also <cf/.rd/ which extracts the Route Distinguisher.
-       Their literals are written as <cf><m/vpnrd/ <m/ipprefix/</cf>
+       <cf/NET_VPN4/ and <cf/NET_VPN6/ prefixes hold an IP prefix with VPN
+       Route Distinguisher (<rfc id="4364">). They support the same special
+       operators as IP prefixes, and also <cf/.rd/ which extracts the Route
+       Distinguisher. Their literals are written
+       as <cf><m/vpnrd/ <m/ipprefix/</cf>
 
-       <cf/NET_ROA4/ and <cf/NET_ROA6/ prefices hold an IP prefix range together
-       with an ASN. They support the same special operators as IP prefices, and also
-       <cf/.maxlen/ which extracts maximal prefix length, and <cf/.asn/ which extracts the ASN.
+       <cf/NET_ROA4/ and <cf/NET_ROA6/ prefixes hold an IP prefix range
+       together with an ASN. They support the same special operators as IP
+       prefixes, and also <cf/.maxlen/ which extracts maximal prefix length,
+       and <cf/.asn/ which extracts the ASN.
 
-       <cf/NET_FLOW4/ and <cf/NET_FLOW6/ hold an IP prefix together with
-       flowspec rule. Filters currently don't support flowspec parsing.
+       <cf/NET_FLOW4/ and <cf/NET_FLOW6/ hold an IP prefix together with a
+       flowspec rule. Filters currently don't support flowspec parsing.
 
        <tag><label id="type-ec">ec</tag>
        This is a specialized type used to represent BGP extended community
index a3caaf96c68135ce26b1b9efde4de36236eecbbf..616f9e2ae7fb2bba6b355a7e8dac733b946f5712 100644 (file)
@@ -1227,11 +1227,10 @@ interpret(struct f_inst *what)
     ONEARG;
     if (v1.type != T_NET)
       runtime( "Prefix expected" );
-    res.type = T_RD;
-    if ((1 << v1.val.net->type) & (NB_VPN4 | NB_VPN6))
-      res.val.ec = net_rd(v1.val.net);
-    else
+    if (!net_is_vpn(v1.val.net))
       runtime( "VPN address expected" );
+    res.type = T_RD;
+    res.val.ec = net_rd(v1.val.net);
     break;
   case P('a','f'):     /* Get first ASN from AS PATH */
     ONEARG;
index 2bf4049ef052188aa816cf9a41e3e9a072fed89b..c29ed299bb03925a682001a909cc64911204e63f 100644 (file)
--- a/lib/net.c
+++ b/lib/net.c
@@ -81,14 +81,14 @@ net_format(const net_addr *N, char *buf, int buflen)
   case NET_VPN4:
     {
     int c = rd_format(n->vpn4.rd, buf, buflen);
-    buf += c; buflen -= c;
+    ADVANCE(buf, buflen, c);
     return bsnprintf(buf, buflen, " %I4/%d", n->vpn4.prefix, n->vpn4.pxlen);
     }
   case NET_VPN6:
     {
     /* XXX: RD format is specified for VPN4; not found any for VPN6, reusing the same as for VPN4 */
     int c = rd_format(n->vpn6.rd, buf, buflen);
-    buf += c; buflen -= c;
+    ADVANCE(buf, buflen, c);
     return bsnprintf(buf, buflen, " %I6/%d", n->vpn6.prefix, n->vpn6.pxlen);
     }
   case NET_ROA4: