From: Ondrej Zajicek Date: Sat, 12 Jan 2013 21:13:22 +0000 (+0100) Subject: Merge commit '48cf5e84e6ed17578e4ad43c5ef54d6ff7d825c4' into integrated X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f53e2a31d6038d1a48b9f12330ad869aa509022f;p=thirdparty%2Fbird.git Merge commit '48cf5e84e6ed17578e4ad43c5ef54d6ff7d825c4' into integrated --- f53e2a31d6038d1a48b9f12330ad869aa509022f diff --cc conf/cf-lex.l index a46262274,c8eae0e87..8db0dc1c7 --- a/conf/cf-lex.l +++ b/conf/cf-lex.l @@@ -103,12 -105,34 +105,28 @@@ WHITE [ \t include ^{WHITE}*include{WHITE}*\".*\"{WHITE}*; %% - {include} { if(cf_open_hook) new_include(); } + {include} { + char *start, *end; + + if (!ifs->depth) + cf_error("Include not allowed in CLI"); + + start = strchr(yytext, '"'); + start++; + + end = strchr(start, '"'); + *end = 0; + + if (start == end) + cf_error("Include with empty argument"); + + cf_include(start, end-start); + } {DIGIT}+\.{DIGIT}+\.{DIGIT}+\.{DIGIT}+ { -#ifdef IPV6 - if (ipv4_pton_u32(yytext, &cf_lval.i32)) - return RTRID; + if (ip4_pton(yytext, &cf_lval.a4)) + return IP4; cf_error("Invalid IPv4 address %s", yytext); -#else - if (ip_pton(yytext, &cf_lval.a)) - return IPA; - cf_error("Invalid IP address %s", yytext); -#endif } ({XIGIT}*::|({XIGIT}*:){3,})({XIGIT}*|{DIGIT}+\.{DIGIT}+\.{DIGIT}+\.{DIGIT}+) { diff --cc nest/config.Y index cda60f474,a75dd0c34..4b9ba84f8 --- a/nest/config.Y +++ b/nest/config.Y @@@ -44,11 -44,10 +44,11 @@@ CF_DECL CF_KEYWORDS(ROUTER, ID, PROTOCOL, TEMPLATE, PREFERENCE, DISABLED, DEBUG, ALL, OFF, DIRECT) CF_KEYWORDS(INTERFACE, IMPORT, EXPORT, FILTER, NONE, TABLE, STATES, ROUTES, FILTERS) +CF_KEYWORDS(IPV4, IPVX, VPN4, VPN6, MPLS) CF_KEYWORDS(LIMIT, ACTION, WARN, BLOCK, RESTART, DISABLE) CF_KEYWORDS(PASSWORD, FROM, PASSIVE, TO, ID, EVENTS, PACKETS, PROTOCOLS, INTERFACES) -CF_KEYWORDS(PRIMARY, STATS, COUNT, FOR, COMMANDS, PREEXPORT, GENERATE, ROA, MAX, FLUSH) +CF_KEYWORDS(PRIMARY, STATS, COUNT, FOR, COMMANDS, PREEXPORT, GENERATE, ROA, AS, MAX, FLUSH) - CF_KEYWORDS(LISTEN, BGP, V6ONLY, DUAL, ADDRESS, PORT, PASSWORDS, DESCRIPTION) + CF_KEYWORDS(LISTEN, BGP, V6ONLY, DUAL, ADDRESS, PORT, PASSWORDS, DESCRIPTION, SORTED) CF_KEYWORDS(RELOAD, IN, OUT, MRTDUMP, MESSAGES, RESTRICT, MEMORY, IGP_METRIC) CF_ENUM(T_ENUM_RTS, RTS_, DUMMY, STATIC, INHERIT, DEVICE, STATIC_DEVICE, REDIRECT, @@@ -66,7 -65,7 +66,7 @@@ CF_ENUM(T_ENUM_ROA, ROA_, UNKNOWN, VALI %type roa_args %type roa_table_arg %type sym_args - %type proto_start echo_mask echo_size debug_mask debug_list debug_flag mrtdump_mask mrtdump_list mrtdump_flag export_or_preexport roa_mode limit_action table_type -%type proto_start echo_mask echo_size debug_mask debug_list debug_flag mrtdump_mask mrtdump_list mrtdump_flag export_or_preexport roa_mode limit_action tab_sorted ++%type proto_start echo_mask echo_size debug_mask debug_list debug_flag mrtdump_mask mrtdump_list mrtdump_flag export_or_preexport roa_mode limit_action table_type table_sorted %type proto_patt proto_patt2 %type limit_spec @@@ -106,20 -112,19 +106,28 @@@ listen_opt /* Creation of routing tables */ - CF_ADDTO(conf, newtab) -tab_sorted: ++CF_ADDTO(conf, table) ++ ++table_sorted: + { $$ = 0; } + | SORTED { $$ = 1; } + ; -CF_ADDTO(conf, newtab) +table_type: + /* empty */ { $$ = RT_IP; } + | IPV4 { $$ = RT_IPV4; } + | IPVX { $$ = RT_IPV6; } /* XXXX */ + | VPN4 { $$ = RT_VPN4; } + | VPN6 { $$ = RT_VPN6; } + | MPLS { $$ = RT_MPLS; } + ; - newtab: table_type TABLE SYM { - rt_new_table($3, $1); - }; -newtab: TABLE SYM tab_sorted { ++table: table_type TABLE SYM table_sorted { + struct rtable_config *cf; - cf = rt_new_table($2); - cf->sorted = $3; ++ cf = rt_new_table($3, $1); ++ cf->sorted = $4; + } + ; CF_ADDTO(conf, roa_table) diff --cc nest/route.h index b57d51812,524e69b3c..ffae8457d --- a/nest/route.h +++ b/nest/route.h @@@ -239,33 -220,12 +240,34 @@@ typedef struct rte } u; } rte; - #define REF_COW 1 /* Copy this rte on write */ + #define REF_COW 1 /* Copy this rte on write */ +/* Types of routing tables/entries */ +#define RT_IPV4 1 +#define RT_IPV6 2 +#define RT_VPN4 3 +#define RT_VPN6 4 +#define RT_MPLS 5 + +#define RT_MAX 6 + +/* Same tables using bit positions. Used for appropriate table linking on protocol init */ +#define RTB_IPV4 (1 << RT_IPV4) +#define RTB_IPV6 (1 << RT_IPV6) +#define RTB_VPN4 (1 << RT_VPN4) +#define RTB_VPN6 (1 << RT_VPN6) +#define RTB_MPLS (1 << RT_MPLS) + +#define RTB_IP (RTB_IPV4 | RTB_IPV6) + +// XXXX these should probably go away, check their users +#define RT_IP RT_IPV6 + + /* Types of route announcement, also used as flags */ #define RA_OPTIMAL 1 /* Announcement of optimal route change */ - #define RA_ANY 2 /* Announcement of any route change */ + #define RA_ACCEPTED 2 /* Announcement of first accepted route */ + #define RA_ANY 3 /* Announcement of any route change */ struct config; diff --cc nest/rt-table.c index 1c17146e0,118f4c25b..6a31000ea --- a/nest/rt-table.c +++ b/nest/rt-table.c @@@ -1276,8 -1384,12 +1448,12 @@@ rt_next_hop_update(rtable *tab struct rtable_config * -rt_new_table(struct symbol *s) +rt_new_table(struct symbol *s, int addr_type) { + /* Hack that allows to 'redefine' the master table */ + if ((s->class == SYM_TABLE) && (s->def == new_config->master_rtc)) + return s->def; + struct rtable_config *c = cfg_allocz(sizeof(struct rtable_config)); cf_define_symbol(s, SYM_TABLE, c);