Commit 62e64905 authored by Ondrej Zajicek (work)'s avatar Ondrej Zajicek (work)
Browse files

Several minor fixes

parent d311368b
Loading
Loading
Loading
Loading
+28 −11
Original line number Diff line number Diff line
@@ -124,39 +124,56 @@ include ^{WHITE}*include{WHITE}*\".*\"{WHITE}*;
}

[02]:{DIGIT}+:{DIGIT}+ {
  unsigned long int l, len1, len2;
  char *e;
  unsigned long int l;

  if (yytext[0] == '0')
  {
    cf_lval.i64 = 0;
    len1 = 16;
    len2 = 32;
  }
  else
    cf_lval.i64 = 0x2000000000000ULL;
  {
    cf_lval.i64 = 2ULL << 48;
    len1 = 32;
    len2 = 16;
  }

  errno = 0;
  l = strtoul(yytext+2, &e, 10);
  if (e && (*e != ':') || errno == ERANGE || (yytext[0] == '0') && (l >= (1<<16)))
  if (e && (*e != ':') || (errno == ERANGE) || (l >> len1))
    cf_error("ASN out of range");
  cf_lval.i64 |= (((u64) l) << 32);
  cf_lval.i64 |= ((u64) l) << len2;

  errno = 0;
  l = strtoul(e+1, &e, 10);
  if (e && *e || errno == ERANGE || (yytext[0] == '2') && (l >= (1<<16)))
    cf_error("Assigned number out of range");
  if (e && *e || (errno == ERANGE) || (l >> len2))
    cf_error("Number out of range");
  cf_lval.i64 |= l;

  return VPN_RD;
}

1:{DIGIT}+\.{DIGIT}+\.{DIGIT}+\.{DIGIT}+:{DIGIT}+ {
  unsigned long int l;
  char *e = strchr(yytext+2, ':');
  *e++ = '\0';
  ip4_addr ip4;
  char *e;

  cf_lval.i64 = 1ULL << 48;

  e = strchr(yytext+2, ':');
  *e++ = '\0';
  if (!ip4_pton(yytext+2, &ip4))
    cf_error("Invalid IPv4 address %s in Route Distinguisher", yytext+2);
  cf_lval.i64 |= ((u64) ip4_to_u32(ip4)) << 16;

  errno = 0;
  l = strtoul(e, &e, 10);
  if (e && *e || errno == ERANGE || (l >= (1<<16)))
    cf_error("Assigned number out of range");
  cf_lval.i64 = (1ULL<<48) | (((u64)ip4_to_u32(ip4)) << 16) | ((u64)l);
  if (e && *e || (errno == ERANGE) || (l >> 16))
    cf_error("Number out of range");
  cf_lval.i64 |= l;

  return VPN_RD;
}

+6 −5
Original line number Diff line number Diff line
@@ -203,13 +203,13 @@ net_ip6_: IP6 '/' NUM
net_vpn4_: VPN_RD net_ip4_
{
  $$ = cfg_alloc(sizeof(net_addr_vpn4));
  net_fill_vpn4($$, ((net_addr_ip4 *)&$2)->prefix, $2.pxlen, $1);
  net_fill_vpn4($$, net4_prefix(&$2), net4_pxlen(&$2), $1);
}

net_vpn6_: VPN_RD net_ip6_
{
  $$ = cfg_alloc(sizeof(net_addr_vpn6));
  net_fill_vpn6($$, ((net_addr_ip6 *)&$2)->prefix, $2.pxlen, $1);
  net_fill_vpn6($$, net6_prefix(&$2), net6_pxlen(&$2), $1);
}

net_roa4_: net_ip4_ MAX NUM AS NUM
@@ -229,8 +229,8 @@ net_roa6_: net_ip6_ MAX NUM AS NUM
};

net_ip_: net_ip4_ | net_ip6_ ;
net_roa_: net_roa4_ | net_roa6_ ;
net_vpn_: net_vpn4_ | net_vpn6_ ;
net_roa_: net_roa4_ | net_roa6_ ;

net_:
   net_ip_ { $$ = cfg_alloc($1.length); net_copy($$, &($1)); }
@@ -297,8 +297,9 @@ label_stack:
    label_stack_start
  | label_stack '/' NUM {
    if ($1[0] >= MPLS_MAX_LABEL_STACK)
      cf_error("Too many labels in stack.");
    $1[++$1[0]] = $3;
      cf_error("Too many labels in stack");
    $1[0]++;
    $1[*$1] = $3;
    $$ = $1;
  }
;
+5 −5
Original line number Diff line number Diff line
@@ -4140,12 +4140,12 @@ return packets as undeliverable if they are in your IP block, you don't have any
specific destination for them and you don't want to send them out through the
default route to prevent routing loops).

<p>There are five types of static routes: `classical' routes telling to forward
<p>There are four types of static routes: `classical' routes telling to forward
packets to a neighboring router (single path or multipath, possibly weighted),
device routes specifying forwarding to hosts on a
directly connected network, recursive routes computing their nexthops by doing
route table lookups for a given IP, and special routes (sink, blackhole etc.)
which specify a special action to be done instead of forwarding the packet.
device routes specifying forwarding to hosts on a directly connected network,
recursive routes computing their nexthops by doing route table lookups for a
given IP, and special routes (sink, blackhole etc.)  which specify a special
action to be done instead of forwarding the packet.

<p>When the particular destination is not available (the interface is down or
the next hop of the route is not a neighbor at the moment), Static just
+3 −3
Original line number Diff line number Diff line
@@ -174,9 +174,9 @@ void val_format(struct f_val v, buffer *buf);
#define SA_PROTO	 4
#define SA_SOURCE	 5
#define SA_SCOPE	 6
#define SA_DEST    	 8
#define SA_IFNAME  	 9
#define SA_IFINDEX    	10
#define SA_DEST    	 7
#define SA_IFNAME  	 8
#define SA_IFINDEX    	 9


struct f_tree {
+2 −0
Original line number Diff line number Diff line
@@ -15,4 +15,6 @@
#include <stdlib.h>
#endif

#define allocz(len) ({ void *_x = alloca(len); memset(_x, 0, len); _x; })

#endif
Loading