Revision 8a7fb885
doc/bird.sgml | ||
---|---|---|
497 | 497 |
<tag>enable|disable|restart <m/name/|"<m/pattern/"|all</tag> |
498 | 498 |
Enable, disable or restart a given protocol instance, instances matching the <cf><m/pattern/</cf> or <cf/all/ instances. |
499 | 499 |
|
500 |
<tag>reload [in|out] <m/name/|"<m/pattern/"|all</tag> |
|
501 |
|
|
502 |
Reload a given protocol instance, that means re-import routes |
|
503 |
from the protocol instance and re-export preferred routes to |
|
504 |
the instance. If <cf/in/ or <cf/out/ options are used, the |
|
505 |
command is restricted to one direction (re-import or |
|
506 |
re-export). |
|
507 |
|
|
508 |
This command is useful if appropriate filters have changed but |
|
509 |
the protocol instance was not restarted (or reloaded), |
|
510 |
therefore it still propagates the old set of routes. For example |
|
511 |
when <cf/configure soft/ command was used to change filters. |
|
512 |
|
|
513 |
Re-export always succeeds, but re-import is protocol-dependent |
|
514 |
and might fail (for example, if BGP neighbor does not support |
|
515 |
route-refresh extension). In that case, re-export is also |
|
516 |
skipped. |
|
517 |
|
|
500 | 518 |
<tag/down/ |
501 | 519 |
Shut BIRD down. |
502 | 520 |
|
doc/reply_codes | ||
---|---|---|
23 | 23 |
0012 Restarted |
24 | 24 |
0013 Status report |
25 | 25 |
0014 Route count |
26 |
0015 Reloading |
|
26 | 27 |
|
27 | 28 |
1000 BIRD version |
28 | 29 |
1001 Interface list |
... | ... | |
40 | 41 |
1013 Show ospf neighbors |
41 | 42 |
1014 Show ospf |
42 | 43 |
1015 Show ospf interface |
44 |
1016 Show ospf state/topology |
|
43 | 45 |
|
44 | 46 |
8000 Reply too long |
45 | 47 |
8001 Route not found |
... | ... | |
47 | 49 |
8003 No protocols match |
48 | 50 |
8004 Stopped due to reconfiguration |
49 | 51 |
8005 Protocol is down => cannot dump |
52 |
8006 Reload failed |
|
50 | 53 |
|
51 | 54 |
9000 Command too long |
52 | 55 |
9001 Parse error |
nest/config.Y | ||
---|---|---|
45 | 45 |
CF_KEYWORDS(PASSWORD, FROM, PASSIVE, TO, ID, EVENTS, PACKETS, PROTOCOLS, INTERFACES) |
46 | 46 |
CF_KEYWORDS(PRIMARY, STATS, COUNT, FOR, COMMANDS, PREEXPORT, GENERATE) |
47 | 47 |
CF_KEYWORDS(LISTEN, BGP, V6ONLY, ADDRESS, PORT, PASSWORDS, DESCRIPTION) |
48 |
CF_KEYWORDS(RELOAD, REFEED)
|
|
48 |
CF_KEYWORDS(RELOAD, IN, OUT)
|
|
49 | 49 |
|
50 | 50 |
CF_ENUM(T_ENUM_RTS, RTS_, DUMMY, STATIC, INHERIT, DEVICE, STATIC_DEVICE, REDIRECT, |
51 | 51 |
RIP, OSPF, OSPF_IA, OSPF_EXT1, OSPF_EXT2, BGP, PIPE) |
... | ... | |
438 | 438 |
; |
439 | 439 |
|
440 | 440 |
CF_CLI(DISABLE, proto_patt, <protocol> | \"<pattern>\" | all, [[Disable protocol]]) |
441 |
{ proto_xxable($2, 0); } ;
|
|
441 |
{ proto_xxable($2, XX_DISABLE); } ;
|
|
442 | 442 |
CF_CLI(ENABLE, proto_patt, <protocol> | \"<pattern>\" | all, [[Enable protocol]]) |
443 |
{ proto_xxable($2, 1); } ;
|
|
443 |
{ proto_xxable($2, XX_ENABLE); } ;
|
|
444 | 444 |
CF_CLI(RESTART, proto_patt, <protocol> | \"<pattern>\" | all, [[Restart protocol]]) |
445 |
{ proto_xxable($2, 2); } ;
|
|
445 |
{ proto_xxable($2, XX_RESTART); } ;
|
|
446 | 446 |
CF_CLI(RELOAD, proto_patt, <protocol> | \"<pattern>\" | all, [[Reload protocol]]) |
447 |
{ proto_xxable($2, 3); } ;
|
|
448 |
CF_CLI(REFEED, proto_patt, <protocol> | \"<pattern>\" | all, [[Refeed protocol BROKEN]])
|
|
449 |
{ proto_xxable($2, 4); } ;
|
|
450 |
|
|
451 |
|
|
447 |
{ proto_xxable($2, XX_RELOAD); } ;
|
|
448 |
CF_CLI(RELOAD IN, proto_patt, <protocol> | \"<pattern>\" | all, [[Reload protocol (just imported routes)]])
|
|
449 |
{ proto_xxable($3, XX_RELOAD_IN); } ;
|
|
450 |
CF_CLI(RELOAD OUT, proto_patt, <protocol> | \"<pattern>\" | all, [[Reload protocol (just exported routes)]]) |
|
451 |
{ proto_xxable($3, XX_RELOAD_OUT); } ; |
|
452 | 452 |
|
453 | 453 |
CF_CLI_HELP(DEBUG, ..., [[Control protocol debugging]]) |
454 | 454 |
CF_CLI(DEBUG, proto_patt debug_mask, (<protocol> | <pattern> | all) (all | off | { states | routes | filters | events | packets }), [[Control protocol debugging]]) |
nest/proto.c | ||
---|---|---|
586 | 586 |
DBG("%s: Scheduling meal\n", p->name); |
587 | 587 |
p->core_state = FS_FEEDING; |
588 | 588 |
p->refeeding = !initial; |
589 |
|
|
590 |
/* Hack: reset exp_routes during refeed, and do not decrease it later */ |
|
591 |
if (!initial) |
|
592 |
p->stats.exp_routes = 0; |
|
593 |
|
|
589 | 594 |
proto_relink(p); |
590 | 595 |
p->attn->hook = initial ? proto_feed_initial : proto_feed_more; |
591 | 596 |
ev_schedule(p->attn); |
... | ... | |
825 | 830 |
cnt++; |
826 | 831 |
switch (xx) |
827 | 832 |
{ |
828 |
case 0:
|
|
833 |
case XX_DISABLE:
|
|
829 | 834 |
if (p->disabled) |
830 | 835 |
cli_msg(-8, "%s: already disabled", p->name); |
831 | 836 |
else |
... | ... | |
835 | 840 |
proto_rethink_goal(p); |
836 | 841 |
} |
837 | 842 |
break; |
838 |
case 1: |
|
843 |
|
|
844 |
case XX_ENABLE: |
|
839 | 845 |
if (!p->disabled) |
840 | 846 |
cli_msg(-10, "%s: already enabled", p->name); |
841 | 847 |
else |
... | ... | |
845 | 851 |
proto_rethink_goal(p); |
846 | 852 |
} |
847 | 853 |
break; |
848 |
case 2: |
|
854 |
|
|
855 |
case XX_RESTART: |
|
849 | 856 |
if (p->disabled) |
850 | 857 |
cli_msg(-8, "%s: already disabled", p->name); |
851 | 858 |
else |
... | ... | |
857 | 864 |
cli_msg(-12, "%s: restarted", p->name); |
858 | 865 |
} |
859 | 866 |
break; |
860 |
case 3: |
|
861 |
// FIXME change msg number |
|
862 |
if (p->disabled) |
|
863 |
cli_msg(-8, "%s: already disabled", p->name); |
|
864 |
else if (p->reload_routes && p->reload_routes(p)) |
|
865 |
cli_msg(-12, "%s: reloading", p->name); |
|
866 |
else |
|
867 |
cli_msg(-12, "%s: reload failed", p->name); |
|
868 |
break; |
|
869 |
case 4: |
|
870 |
// FIXME change msg number |
|
867 |
|
|
868 |
case XX_RELOAD: |
|
869 |
case XX_RELOAD_IN: |
|
870 |
case XX_RELOAD_OUT: |
|
871 | 871 |
if (p->disabled) |
872 |
cli_msg(-8, "%s: already disabled", p->name); |
|
873 |
else |
|
874 | 872 |
{ |
875 |
proto_request_feeding(p);
|
|
876 |
cli_msg(-12, "%s: reexport failed", p->name);
|
|
873 |
cli_msg(-8, "%s: already disabled", p->name);
|
|
874 |
break;
|
|
877 | 875 |
} |
876 |
|
|
877 |
/* re-importing routes */ |
|
878 |
if (xx != XX_RELOAD_OUT) |
|
879 |
if (! (p->reload_routes && p->reload_routes(p))) |
|
880 |
{ |
|
881 |
cli_msg(-8006, "%s: reload failed", p->name); |
|
882 |
break; |
|
883 |
} |
|
884 |
|
|
885 |
/* re-exporting routes */ |
|
886 |
if (xx != XX_RELOAD_IN) |
|
887 |
proto_request_feeding(p); |
|
888 |
|
|
889 |
cli_msg(-15, "%s: reloading", p->name); |
|
878 | 890 |
break; |
879 | 891 |
|
880 | 892 |
default: |
nest/protocol.h | ||
---|---|---|
201 | 201 |
void proto_xxable(char *, int); |
202 | 202 |
void proto_debug(char *, unsigned int); |
203 | 203 |
|
204 |
#define XX_DISABLE 0 |
|
205 |
#define XX_ENABLE 1 |
|
206 |
#define XX_RESTART 2 |
|
207 |
#define XX_RELOAD 3 |
|
208 |
#define XX_RELOAD_IN 4 |
|
209 |
#define XX_RELOAD_OUT 5 |
|
210 |
|
|
204 | 211 |
static inline u32 |
205 | 212 |
proto_get_router_id(struct proto_config *pc) |
206 | 213 |
{ |
nest/rt-table.c | ||
---|---|---|
165 | 165 |
rte *old0 = old; |
166 | 166 |
int ok; |
167 | 167 |
|
168 |
int fast_exit_hack = 0; |
|
169 |
|
|
168 | 170 |
if (new) |
169 | 171 |
{ |
170 | 172 |
p->stats.exp_updates_received++; |
... | ... | |
174 | 176 |
{ |
175 | 177 |
p->stats.exp_updates_rejected++; |
176 | 178 |
drop_reason = "out of scope"; |
179 |
fast_exit_hack = 1; |
|
177 | 180 |
} |
178 | 181 |
else if ((ok = p->import_control ? p->import_control(p, &new, &tmpa, rte_update_pool) : 0) < 0) |
179 | 182 |
{ |
... | ... | |
199 | 202 |
else |
200 | 203 |
p->stats.exp_withdraws_received++; |
201 | 204 |
|
205 |
/* Hack: This is here to prevent 'spurious withdraws' |
|
206 |
for loopback addresses during reload. */ |
|
207 |
if (fast_exit_hack) |
|
208 |
return; |
|
209 |
|
|
202 | 210 |
/* |
203 | 211 |
* This is a tricky part - we don't know whether route 'old' was |
204 | 212 |
* exported to protocol 'p' or was filtered by the export filter. |
... | ... | |
245 | 253 |
else |
246 | 254 |
p->stats.exp_withdraws_accepted++; |
247 | 255 |
|
256 |
/* Hack: We do not decrease exp_routes during refeed, we instead |
|
257 |
reset exp_routes at the start of refeed. */ |
|
248 | 258 |
if (new) |
249 | 259 |
p->stats.exp_routes++; |
250 |
if (old) |
|
260 |
if (old && !refeed)
|
|
251 | 261 |
p->stats.exp_routes--; |
252 | 262 |
|
253 | 263 |
if (p->debug & D_ROUTES) |
Also available in: Unified diff