1 /* $OpenBSD: printconf.c,v 1.85 2010/12/31 21:22:42 guenther Exp $ */ 2 3 /* 4 * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA, PROFITS OR MIND, WHETHER IN 15 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 16 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 #include <limits.h> 20 #include <stdio.h> 21 #include <stdlib.h> 22 #include <string.h> 23 24 #include "bgpd.h" 25 #include "mrt.h" 26 #include "session.h" 27 #include "rde.h" 28 29 void print_op(enum comp_ops); 30 void print_community(int, int); 31 void print_extcommunity(struct filter_extcommunity *); 32 void print_origin(u_int8_t); 33 void print_set(struct filter_set_head *); 34 void print_mainconf(struct bgpd_config *); 35 void print_rdomain_targets(struct filter_set_head *, const char *); 36 void print_rdomain(struct rdomain *); 37 const char *print_af(u_int8_t); 38 void print_network(struct network_config *); 39 void print_peer(struct peer_config *, struct bgpd_config *, 40 const char *); 41 const char *print_auth_alg(u_int8_t); 42 const char *print_enc_alg(u_int8_t); 43 void print_announce(struct peer_config *, const char *); 44 void print_rule(struct peer *, struct filter_rule *); 45 const char * mrt_type(enum mrt_type); 46 void print_mrt(u_int32_t, u_int32_t, const char *, const char *); 47 void print_groups(struct bgpd_config *, struct peer *); 48 int peer_compare(const void *, const void *); 49 50 void 51 print_op(enum comp_ops op) 52 { 53 switch (op) { 54 case OP_RANGE: 55 printf("-"); 56 break; 57 case OP_XRANGE: 58 printf("><"); 59 break; 60 case OP_EQ: 61 printf("="); 62 break; 63 case OP_NE: 64 printf("!="); 65 break; 66 case OP_LE: 67 printf("<="); 68 break; 69 case OP_LT: 70 printf("<"); 71 break; 72 case OP_GE: 73 printf(">="); 74 break; 75 case OP_GT: 76 printf(">"); 77 break; 78 default: 79 printf("?"); 80 break; 81 } 82 } 83 84 void 85 print_community(int as, int type) 86 { 87 if (as == COMMUNITY_ANY) 88 printf("*:"); 89 else if (as == COMMUNITY_NEIGHBOR_AS) 90 printf("neighbor-as:"); 91 else 92 printf("%d:", as); 93 94 if (type == COMMUNITY_ANY) 95 printf("* "); 96 else if (type == COMMUNITY_NEIGHBOR_AS) 97 printf("neighbor-as "); 98 else 99 printf("%d ", type); 100 } 101 102 void 103 print_extcommunity(struct filter_extcommunity *c) 104 { 105 switch (c->type & EXT_COMMUNITY_VALUE) { 106 case EXT_COMMUNITY_TWO_AS: 107 printf("%s %i:%i ", log_ext_subtype(c->subtype), 108 c->data.ext_as.as, c->data.ext_as.val); 109 break; 110 case EXT_COMMUNITY_IPV4: 111 printf("%s %s:%i ", log_ext_subtype(c->subtype), 112 inet_ntoa(c->data.ext_ip.addr), c->data.ext_ip.val); 113 break; 114 case EXT_COMMUNITY_FOUR_AS: 115 printf("%s %s:%i ", log_ext_subtype(c->subtype), 116 log_as(c->data.ext_as4.as4), c->data.ext_as.val); 117 break; 118 case EXT_COMMUNITY_OPAQUE: 119 printf("%s 0x%llx ", log_ext_subtype(c->subtype), 120 c->data.ext_opaq); 121 break; 122 default: 123 printf("0x%x 0x%llx ", c->type, c->data.ext_opaq); 124 break; 125 } 126 } 127 128 void 129 print_origin(u_int8_t o) 130 { 131 if (o == ORIGIN_IGP) 132 printf("igp "); 133 else if (o == ORIGIN_EGP) 134 printf("egp "); 135 else if (o == ORIGIN_INCOMPLETE) 136 printf("incomplete "); 137 else 138 printf("%u ", o); 139 } 140 141 void 142 print_set(struct filter_set_head *set) 143 { 144 struct filter_set *s; 145 146 if (TAILQ_EMPTY(set)) 147 return; 148 149 printf("set { "); 150 TAILQ_FOREACH(s, set, entry) { 151 switch (s->type) { 152 case ACTION_SET_LOCALPREF: 153 printf("localpref %u ", s->action.metric); 154 break; 155 case ACTION_SET_RELATIVE_LOCALPREF: 156 printf("localpref %+d ", s->action.relative); 157 break; 158 case ACTION_SET_MED: 159 printf("metric %u ", s->action.metric); 160 break; 161 case ACTION_SET_RELATIVE_MED: 162 printf("metric %+d ", s->action.relative); 163 break; 164 case ACTION_SET_WEIGHT: 165 printf("weight %u ", s->action.metric); 166 break; 167 case ACTION_SET_RELATIVE_WEIGHT: 168 printf("weight %+d ", s->action.relative); 169 break; 170 case ACTION_SET_NEXTHOP: 171 printf("nexthop %s ", log_addr(&s->action.nexthop)); 172 break; 173 case ACTION_SET_NEXTHOP_REJECT: 174 printf("nexthop reject "); 175 break; 176 case ACTION_SET_NEXTHOP_BLACKHOLE: 177 printf("nexthop blackhole "); 178 break; 179 case ACTION_SET_NEXTHOP_NOMODIFY: 180 printf("nexthop no-modify "); 181 break; 182 case ACTION_SET_NEXTHOP_SELF: 183 printf("nexthop self "); 184 break; 185 case ACTION_SET_PREPEND_SELF: 186 printf("prepend-self %u ", s->action.prepend); 187 break; 188 case ACTION_SET_PREPEND_PEER: 189 printf("prepend-neighbor %u ", s->action.prepend); 190 break; 191 case ACTION_DEL_COMMUNITY: 192 printf("community delete "); 193 print_community(s->action.community.as, 194 s->action.community.type); 195 printf(" "); 196 break; 197 case ACTION_SET_COMMUNITY: 198 printf("community "); 199 print_community(s->action.community.as, 200 s->action.community.type); 201 printf(" "); 202 break; 203 case ACTION_PFTABLE: 204 printf("pftable %s ", s->action.pftable); 205 break; 206 case ACTION_RTLABEL: 207 printf("rtlabel %s ", s->action.rtlabel); 208 break; 209 case ACTION_SET_ORIGIN: 210 printf("origin "); 211 print_origin(s->action.origin); 212 break; 213 case ACTION_RTLABEL_ID: 214 case ACTION_PFTABLE_ID: 215 /* not possible */ 216 printf("king bula saiz: config broken"); 217 break; 218 case ACTION_SET_EXT_COMMUNITY: 219 printf("ext-community "); 220 print_extcommunity(&s->action.ext_community); 221 break; 222 case ACTION_DEL_EXT_COMMUNITY: 223 printf("ext-community delete "); 224 print_extcommunity(&s->action.ext_community); 225 break; 226 } 227 } 228 printf("}"); 229 } 230 231 void 232 print_mainconf(struct bgpd_config *conf) 233 { 234 struct in_addr ina; 235 struct listen_addr *la; 236 237 printf("AS %s", log_as(conf->as)); 238 if (conf->as > USHRT_MAX && conf->short_as != AS_TRANS) 239 printf(" %u", conf->short_as); 240 ina.s_addr = conf->bgpid; 241 printf("\nrouter-id %s\n", inet_ntoa(ina)); 242 243 printf("socket \"%s\"\n", conf->csock); 244 if (conf->rcsock) 245 printf("socket \"%s\" restricted\n", conf->rcsock); 246 if (conf->holdtime) 247 printf("holdtime %u\n", conf->holdtime); 248 if (conf->min_holdtime) 249 printf("holdtime min %u\n", conf->min_holdtime); 250 if (conf->connectretry) 251 printf("connect-retry %u\n", conf->connectretry); 252 253 if (conf->flags & BGPD_FLAG_NO_EVALUATE) 254 printf("route-collector yes\n"); 255 256 if (conf->flags & BGPD_FLAG_DECISION_ROUTEAGE) 257 printf("rde route-age evaluate\n"); 258 259 if (conf->flags & BGPD_FLAG_DECISION_MED_ALWAYS) 260 printf("rde med compare always\n"); 261 262 if (conf->log & BGPD_LOG_UPDATES) 263 printf("log updates\n"); 264 265 TAILQ_FOREACH(la, conf->listen_addrs, entry) 266 printf("listen on %s\n", 267 log_sockaddr((struct sockaddr *)&la->sa)); 268 269 if (conf->flags & BGPD_FLAG_NEXTHOP_BGP) 270 printf("nexthop qualify via bgp\n"); 271 if (conf->flags & BGPD_FLAG_NEXTHOP_DEFAULT) 272 printf("nexthop qualify via default\n"); 273 } 274 275 void 276 print_rdomain_targets(struct filter_set_head *set, const char *tgt) 277 { 278 struct filter_set *s; 279 TAILQ_FOREACH(s, set, entry) { 280 printf("\t%s ", tgt); 281 print_extcommunity(&s->action.ext_community); 282 printf("\n"); 283 } 284 } 285 286 void 287 print_rdomain(struct rdomain *r) 288 { 289 printf("rdomain %u {\n", r->rtableid); 290 printf("\tdescr \"%s\"\n", r->descr); 291 if (r->flags & F_RIB_NOFIBSYNC) 292 printf("\tfib-update no\n"); 293 else 294 printf("\tfib-update yes\n"); 295 printf("\tdepend on %s\n", r->ifmpe); 296 297 printf("\n\t%s\n", log_rd(r->rd)); 298 299 print_rdomain_targets(&r->export, "export-target"); 300 print_rdomain_targets(&r->import, "import-target"); 301 302 printf("}\n"); 303 } 304 305 const char * 306 print_af(u_int8_t aid) 307 { 308 /* 309 * Hack around the fact that aid2str() will return "IPv4 unicast" 310 * for AID_INET. AID_INET and AID_INET6 need special handling and 311 * the other AID should never end up here (at least for now). 312 */ 313 if (aid == AID_INET) 314 return ("inet"); 315 if (aid == AID_INET6) 316 return ("inet6"); 317 return (aid2str(aid)); 318 } 319 320 void 321 print_network(struct network_config *n) 322 { 323 switch (n->type) { 324 case NETWORK_STATIC: 325 printf("network %s static", print_af(n->prefix.aid)); 326 break; 327 case NETWORK_CONNECTED: 328 printf("network %s connected", print_af(n->prefix.aid)); 329 break; 330 default: 331 printf("network %s/%u", log_addr(&n->prefix), n->prefixlen); 332 break; 333 } 334 if (!TAILQ_EMPTY(&n->attrset)) 335 printf(" "); 336 print_set(&n->attrset); 337 printf("\n"); 338 } 339 340 void 341 print_peer(struct peer_config *p, struct bgpd_config *conf, const char *c) 342 { 343 char *method; 344 struct in_addr ina; 345 346 if ((p->remote_addr.aid == AID_INET && p->remote_masklen != 32) || 347 (p->remote_addr.aid == AID_INET6 && p->remote_masklen != 128)) 348 printf("%sneighbor %s/%u {\n", c, log_addr(&p->remote_addr), 349 p->remote_masklen); 350 else 351 printf("%sneighbor %s {\n", c, log_addr(&p->remote_addr)); 352 if (p->descr[0]) 353 printf("%s\tdescr \"%s\"\n", c, p->descr); 354 if (p->rib[0]) 355 printf("%s\trib \"%s\"\n", c, p->rib); 356 if (p->remote_as) 357 printf("%s\tremote-as %s\n", c, log_as(p->remote_as)); 358 if (p->down) 359 printf("%s\tdown\n", c); 360 if (p->distance > 1) 361 printf("%s\tmultihop %u\n", c, p->distance); 362 if (p->passive) 363 printf("%s\tpassive\n", c); 364 if (p->local_addr.aid) 365 printf("%s\tlocal-address %s\n", c, log_addr(&p->local_addr)); 366 if (p->max_prefix) { 367 printf("%s\tmax-prefix %u", c, p->max_prefix); 368 if (p->max_prefix_restart) 369 printf(" restart %u", p->max_prefix_restart); 370 printf("\n"); 371 } 372 if (p->holdtime) 373 printf("%s\tholdtime %u\n", c, p->holdtime); 374 if (p->min_holdtime) 375 printf("%s\tholdtime min %u\n", c, p->min_holdtime); 376 if (p->announce_capa == 0) 377 printf("%s\tannounce capabilities no\n", c); 378 if (p->capabilities.refresh == 0) 379 printf("%s\tannounce refresh no\n", c); 380 if (p->capabilities.restart == 1) 381 printf("%s\tannounce restart yes\n", c); 382 if (p->capabilities.as4byte == 0) 383 printf("%s\tannounce as4byte no\n", c); 384 if (p->announce_type == ANNOUNCE_SELF) 385 printf("%s\tannounce self\n", c); 386 else if (p->announce_type == ANNOUNCE_NONE) 387 printf("%s\tannounce none\n", c); 388 else if (p->announce_type == ANNOUNCE_ALL) 389 printf("%s\tannounce all\n", c); 390 else if (p->announce_type == ANNOUNCE_DEFAULT_ROUTE) 391 printf("%s\tannounce default-route\n", c); 392 else 393 printf("%s\tannounce ???\n", c); 394 if (p->enforce_as == ENFORCE_AS_ON) 395 printf("%s\tenforce neighbor-as yes\n", c); 396 else 397 printf("%s\tenforce neighbor-as no\n", c); 398 if (p->reflector_client) { 399 if (conf->clusterid == 0) 400 printf("%s\troute-reflector\n", c); 401 else { 402 ina.s_addr = conf->clusterid; 403 printf("%s\troute-reflector %s\n", c, 404 inet_ntoa(ina)); 405 } 406 } 407 if (p->demote_group[0]) 408 printf("%s\tdemote %s\n", c, p->demote_group); 409 if (p->if_depend[0]) 410 printf("%s\tdepend on \"%s\"\n", c, p->if_depend); 411 if (p->flags & PEERFLAG_TRANS_AS) 412 printf("%s\ttransparent-as yes\n", c); 413 414 if (p->auth.method == AUTH_MD5SIG) 415 printf("%s\ttcp md5sig\n", c); 416 else if (p->auth.method == AUTH_IPSEC_MANUAL_ESP || 417 p->auth.method == AUTH_IPSEC_MANUAL_AH) { 418 if (p->auth.method == AUTH_IPSEC_MANUAL_ESP) 419 method = "esp"; 420 else 421 method = "ah"; 422 423 printf("%s\tipsec %s in spi %u %s XXXXXX", c, method, 424 p->auth.spi_in, print_auth_alg(p->auth.auth_alg_in)); 425 if (p->auth.enc_alg_in) 426 printf(" %s XXXXXX", print_enc_alg(p->auth.enc_alg_in)); 427 printf("\n"); 428 429 printf("%s\tipsec %s out spi %u %s XXXXXX", c, method, 430 p->auth.spi_out, print_auth_alg(p->auth.auth_alg_out)); 431 if (p->auth.enc_alg_out) 432 printf(" %s XXXXXX", 433 print_enc_alg(p->auth.enc_alg_out)); 434 printf("\n"); 435 } else if (p->auth.method == AUTH_IPSEC_IKE_AH) 436 printf("%s\tipsec ah ike\n", c); 437 else if (p->auth.method == AUTH_IPSEC_IKE_ESP) 438 printf("%s\tipsec esp ike\n", c); 439 440 if (p->ttlsec) 441 printf("%s\tttl-security yes\n", c); 442 443 print_announce(p, c); 444 445 if (p->softreconfig_in == 1) 446 printf("%s\tsoftreconfig in yes\n", c); 447 else 448 printf("%s\tsoftreconfig in no\n", c); 449 450 if (p->softreconfig_out == 1) 451 printf("%s\tsoftreconfig out yes\n", c); 452 else 453 printf("%s\tsoftreconfig out no\n", c); 454 455 456 print_mrt(p->id, p->groupid, c, "\t"); 457 458 printf("%s}\n", c); 459 } 460 461 const char * 462 print_auth_alg(u_int8_t alg) 463 { 464 switch (alg) { 465 case SADB_AALG_SHA1HMAC: 466 return ("sha1"); 467 case SADB_AALG_MD5HMAC: 468 return ("md5"); 469 default: 470 return ("???"); 471 } 472 } 473 474 const char * 475 print_enc_alg(u_int8_t alg) 476 { 477 switch (alg) { 478 case SADB_EALG_3DESCBC: 479 return ("3des"); 480 case SADB_X_EALG_AES: 481 return ("aes"); 482 default: 483 return ("???"); 484 } 485 } 486 487 void 488 print_announce(struct peer_config *p, const char *c) 489 { 490 u_int8_t aid; 491 492 for (aid = 0; aid < AID_MAX; aid++) 493 if (p->capabilities.mp[aid]) 494 printf("%s\tannounce %s\n", c, aid2str(aid)); 495 } 496 497 void 498 print_rule(struct peer *peer_l, struct filter_rule *r) 499 { 500 struct peer *p; 501 502 if (r->action == ACTION_ALLOW) 503 printf("allow "); 504 else if (r->action == ACTION_DENY) 505 printf("deny "); 506 else 507 printf("match "); 508 if (r->quick) 509 printf("quick "); 510 511 if (r->rib[0]) 512 printf("rib %s ", r->rib); 513 514 if (r->dir == DIR_IN) 515 printf("from "); 516 else if (r->dir == DIR_OUT) 517 printf("to "); 518 else 519 printf("eeeeeeeps. "); 520 521 if (r->peer.peerid) { 522 for (p = peer_l; p != NULL && p->conf.id != r->peer.peerid; 523 p = p->next) 524 ; /* nothing */ 525 if (p == NULL) 526 printf("? "); 527 else 528 printf("%s ", log_addr(&p->conf.remote_addr)); 529 } else if (r->peer.groupid) { 530 for (p = peer_l; p != NULL && 531 p->conf.groupid != r->peer.groupid; p = p->next) 532 ; /* nothing */ 533 if (p == NULL) 534 printf("group ? "); 535 else 536 printf("group \"%s\" ", p->conf.group); 537 } else 538 printf("any "); 539 540 if (r->match.prefix.addr.aid) 541 printf("prefix %s/%u ", log_addr(&r->match.prefix.addr), 542 r->match.prefix.len); 543 544 if (r->match.prefix.addr.aid == 0 && r->match.prefixlen.aid) { 545 if (r->match.prefixlen.aid == AID_INET) 546 printf("inet "); 547 if (r->match.prefixlen.aid == AID_INET6) 548 printf("inet6 "); 549 } 550 551 if (r->match.prefixlen.op) { 552 if (r->match.prefixlen.op == OP_RANGE || 553 r->match.prefixlen.op == OP_XRANGE) { 554 printf("prefixlen %u ", r->match.prefixlen.len_min); 555 print_op(r->match.prefixlen.op); 556 printf(" %u ", r->match.prefixlen.len_max); 557 } else { 558 printf("prefixlen "); 559 print_op(r->match.prefixlen.op); 560 printf(" %u ", r->match.prefixlen.len_min); 561 } 562 } 563 564 if (r->match.as.type) { 565 if (r->match.as.type == AS_ALL) 566 printf("AS %s ", log_as(r->match.as.as)); 567 else if (r->match.as.type == AS_SOURCE) 568 printf("source-as %s ", log_as(r->match.as.as)); 569 else if (r->match.as.type == AS_TRANSIT) 570 printf("transit-as %s ", log_as(r->match.as.as)); 571 else if (r->match.as.type == AS_PEER) 572 printf("peer-as %s ", log_as(r->match.as.as)); 573 else 574 printf("unfluffy-as %s ", log_as(r->match.as.as)); 575 } 576 577 if (r->match.aslen.type) { 578 printf("%s %u ", r->match.aslen.type == ASLEN_MAX ? 579 "max-as-len" : "max-as-seq", r->match.aslen.aslen); 580 } 581 582 if (r->match.community.as != COMMUNITY_UNSET) { 583 printf("community "); 584 print_community(r->match.community.as, 585 r->match.community.type); 586 } 587 if (r->match.ext_community.flags & EXT_COMMUNITY_FLAG_VALID) { 588 printf("ext-community "); 589 print_extcommunity(&r->match.ext_community); 590 } 591 592 print_set(&r->set); 593 594 printf("\n"); 595 } 596 597 const char * 598 mrt_type(enum mrt_type t) 599 { 600 switch (t) { 601 case MRT_NONE: 602 break; 603 case MRT_TABLE_DUMP: 604 return "table"; 605 case MRT_TABLE_DUMP_MP: 606 return "table-mp"; 607 case MRT_ALL_IN: 608 return "all in"; 609 case MRT_ALL_OUT: 610 return "all out"; 611 case MRT_UPDATE_IN: 612 return "updates in"; 613 case MRT_UPDATE_OUT: 614 return "updates out"; 615 } 616 return "unfluffy MRT"; 617 } 618 619 struct mrt_head *xmrt_l = NULL; 620 621 void 622 print_mrt(u_int32_t pid, u_int32_t gid, const char *prep, const char *prep2) 623 { 624 struct mrt *m; 625 626 if (xmrt_l == NULL) 627 return; 628 629 LIST_FOREACH(m, xmrt_l, entry) 630 if ((gid != 0 && m->group_id == gid) || 631 (m->peer_id == pid && m->group_id == gid)) { 632 printf("%s%sdump ", prep, prep2); 633 if (m->rib[0]) 634 printf("rib %s ", m->rib); 635 if (MRT2MC(m)->ReopenTimerInterval == 0) 636 printf("%s %s\n", mrt_type(m->type), 637 MRT2MC(m)->name); 638 else 639 printf("%s %s %d\n", mrt_type(m->type), 640 MRT2MC(m)->name, 641 MRT2MC(m)->ReopenTimerInterval); 642 } 643 } 644 645 void 646 print_groups(struct bgpd_config *conf, struct peer *peer_l) 647 { 648 struct peer_config **peerlist; 649 struct peer *p; 650 u_int peer_cnt, i; 651 u_int32_t prev_groupid; 652 const char *tab = "\t"; 653 const char *nada = ""; 654 const char *c; 655 656 peer_cnt = 0; 657 for (p = peer_l; p != NULL; p = p->next) 658 peer_cnt++; 659 660 if ((peerlist = calloc(peer_cnt, sizeof(struct peer_config *))) == NULL) 661 fatal("print_groups calloc"); 662 663 i = 0; 664 for (p = peer_l; p != NULL; p = p->next) 665 peerlist[i++] = &p->conf; 666 667 qsort(peerlist, peer_cnt, sizeof(struct peer_config *), peer_compare); 668 669 prev_groupid = 0; 670 for (i = 0; i < peer_cnt; i++) { 671 if (peerlist[i]->groupid) { 672 c = tab; 673 if (peerlist[i]->groupid != prev_groupid) { 674 if (prev_groupid) 675 printf("}\n\n"); 676 printf("group \"%s\" {\n", peerlist[i]->group); 677 prev_groupid = peerlist[i]->groupid; 678 } 679 } else 680 c = nada; 681 682 print_peer(peerlist[i], conf, c); 683 } 684 685 if (prev_groupid) 686 printf("}\n\n"); 687 688 free(peerlist); 689 } 690 691 int 692 peer_compare(const void *aa, const void *bb) 693 { 694 const struct peer_config * const *a; 695 const struct peer_config * const *b; 696 697 a = aa; 698 b = bb; 699 700 return ((*a)->groupid - (*b)->groupid); 701 } 702 703 void 704 print_config(struct bgpd_config *conf, struct rib_names *rib_l, 705 struct network_head *net_l, struct peer *peer_l, 706 struct filter_head *rules_l, struct mrt_head *mrt_l, 707 struct rdomain_head *rdom_l) 708 { 709 struct filter_rule *r; 710 struct network *n; 711 struct rde_rib *rr; 712 struct rdomain *rd; 713 714 xmrt_l = mrt_l; 715 print_mainconf(conf); 716 printf("\n"); 717 TAILQ_FOREACH(n, net_l, entry) 718 print_network(&n->net); 719 printf("\n"); 720 SIMPLEQ_FOREACH(rd, rdom_l, entry) 721 print_rdomain(rd); 722 printf("\n"); 723 SIMPLEQ_FOREACH(rr, rib_l, entry) { 724 if (rr->flags & F_RIB_NOEVALUATE) 725 printf("rde rib %s no evaluate\n", rr->name); 726 else if (rr->flags & F_RIB_NOFIB) 727 printf("rde rib %s\n", rr->name); 728 else 729 printf("rde rib %s rtable %u fib-update %s\n", rr->name, 730 rr->rtableid, rr->flags & F_RIB_NOFIBSYNC ? 731 "no" : "yes"); 732 } 733 printf("\n"); 734 print_mrt(0, 0, "", ""); 735 printf("\n"); 736 print_groups(conf, peer_l); 737 printf("\n"); 738 TAILQ_FOREACH(r, rules_l, entry) 739 print_rule(peer_l, r); 740 } 741