diff options
Diffstat (limited to 'ospfd')
-rw-r--r-- | ospfd/ChangeLog | 77 | ||||
-rw-r--r-- | ospfd/ospf_interface.c | 3 | ||||
-rw-r--r-- | ospfd/ospf_interface.h | 7 | ||||
-rw-r--r-- | ospfd/ospf_main.c | 12 | ||||
-rw-r--r-- | ospfd/ospf_packet.c | 61 | ||||
-rw-r--r-- | ospfd/ospf_vty.c | 153 | ||||
-rw-r--r-- | ospfd/ospf_zebra.c | 47 | ||||
-rw-r--r-- | ospfd/ospfd.c | 4 | ||||
-rw-r--r-- | ospfd/ospfd.h | 1 |
9 files changed, 283 insertions, 82 deletions
diff --git a/ospfd/ChangeLog b/ospfd/ChangeLog index 0015ee6d..0a2b9994 100644 --- a/ospfd/ChangeLog +++ b/ospfd/ChangeLog @@ -1,3 +1,80 @@ +2006-12-04 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * ospfd.c: (ospf_network_run) Remove an offending 'break' statement. + Previously, after creating a single ospf_interface on a given + network interface, the code would skip to the next interface + without considering other connected addresses on the interface. + After removing the 'break', we now consider all connected addresses. + +2006-11-30 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * ospf_zebra.c: (ospf_router_id_update_zebra, + ospf_interface_address_add, ospf_interface_address_delete) + If (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE)) is enabled, then + add a debug message about what Zebra is telling us. + (ospf_zebra_add_discard) Add a debug message matching the one + already in ospf_zebra_delete_discard. + +2006-11-28 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * ospf_vty.c: (ospf_passive_interface_default) Take additional + 'newval' arg so we can update ospf->passive_interface_default inside + this function. More importantly, we now call ospf_if_set_multicast + on all ospf_interfaces. + (ospf_passive_interface, no_ospf_passive_interface) Fix bug: + for 'default' case, argv[0] is undefined, so we must test for + (argc == 0) before using argv[0]. And since + ospf_passive_interface_default now calls ospf_if_set_multicast as + needed, we can just return after calling + ospf_passive_interface_default. + +2006-10-24 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * ospf_zebra.c: (ospf_redistribute_default_set) Fix bug where + a new value for ospf->default_originate was being ignored + if a previous 'default-information originate' command + had already been processed. + +2006-10-22 Yar Tikhiy <yar@comp.chem.msu.su> + + * (general) Add support for passive-interface default (with + minor edits by Paul Jakma). + * ospf_interface.h: Add OSPF_IF_PASSIVE_STATUS macro, looking + at configured value, or the global 'default' value, as + required. + * ospf_interface.c: (ospf_if_new_hook) Leave passive + unconfigured per default, allowing global 'default' to + take effect for unconfigured interfaces. + * ospf_packet.c: (various) use OSPF_IF_PASSIVE_STATUS + * ospf_vty.c: (ospf_passive_interface_default) new function, + unset passive from all interfaces if default is enabled, as + the per-iface settings become redundant. + (ospf_passive_interface_update) new func, update passive + setting taking global default into account. + ({no,}ospf_passive_interface_addr_cmd) Add support for + 'default' variant of command. + (show_ip_ospf_interface_sub) Update to take global + default into account when printing passive status. + (ospf_config_write) ditto. + * ospfd.c: (ospf_new) set global passive-interface default. + * ospfd.h: (struct ospf) Add field for global + passive-interface. + +2006-09-25 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * ospf_packet.c: (ospf_packet_dup, ospf_make_md5_digest) + Fix zlog_warn messages to eliminate compiler warnings. + (ospf_hello) Improve warning messages to show why we + are complaining. + +2006-08-28 Andy Gay <andy@andynet.net> + + * ospf_packet.c: (ospf_make_db_desc) Assert added with More-bit + fixes does not hold up with addition of Ogier DB-Exchange + optimisation, which can empty the db-summary list in between + sent DD packets. Remove assert, update More-bit always when + in Exchange. + 2006-08-27 J.J. Krabbendam <jkrabbendam@aimsys.nl> * ospfd.c: (ospf_finish_final) default redistribute should be diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c index 31275f89..b6e34746 100644 --- a/ospfd/ospf_interface.c +++ b/ospfd/ospf_interface.c @@ -682,9 +682,6 @@ ospf_if_new_hook (struct interface *ifp) IF_DEF_PARAMS (ifp)->mtu_ignore = OSPF_MTU_IGNORE_DEFAULT; - SET_IF_PARAM (IF_DEF_PARAMS (ifp), passive_interface); - IF_DEF_PARAMS (ifp)->passive_interface = OSPF_IF_ACTIVE; - SET_IF_PARAM (IF_DEF_PARAMS (ifp), v_hello); IF_DEF_PARAMS (ifp)->v_hello = OSPF_HELLO_INTERVAL_DEFAULT; diff --git a/ospfd/ospf_interface.h b/ospfd/ospf_interface.h index 5a825ea5..79b178d8 100644 --- a/ospfd/ospf_interface.h +++ b/ospfd/ospf_interface.h @@ -50,6 +50,13 @@ struct ospf_if_params DECLARE_IF_PARAM (u_char, type); /* type of interface */ #define OSPF_IF_ACTIVE 0 #define OSPF_IF_PASSIVE 1 + +#define OSPF_IF_PASSIVE_STATUS(O) \ + (OSPF_IF_PARAM_CONFIGURED((O)->params, passive_interface) ? \ + (O)->params->passive_interface : \ + (OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS((O)->ifp), passive_interface) ? \ + IF_DEF_PARAMS((O)->ifp)->passive_interface : \ + (O)->ospf->passive_interface_default)) DECLARE_IF_PARAM (u_int32_t, v_hello); /* Hello Interval */ DECLARE_IF_PARAM (u_int32_t, v_wait); /* Router Dead Interval */ diff --git a/ospfd/ospf_main.c b/ospfd/ospf_main.c index c105f192..27a12dd0 100644 --- a/ospfd/ospf_main.c +++ b/ospfd/ospf_main.c @@ -81,6 +81,7 @@ struct option longopts[] = { "config_file", required_argument, NULL, 'f'}, { "pid_file", required_argument, NULL, 'i'}, { "log_mode", no_argument, NULL, 'l'}, + { "dryrun", no_argument, NULL, 'C'}, { "help", no_argument, NULL, 'h'}, { "vty_addr", required_argument, NULL, 'A'}, { "vty_port", required_argument, NULL, 'P'}, @@ -122,6 +123,7 @@ Daemon which manages OSPF.\n\n\ -g, --group Group to run as\n\ -a. --apiserver Enable OSPF apiserver\n\ -v, --version Print program version\n\ +-C, --dryrun Check configuration for validity and exit\n\ -h, --help Display this help and exit\n\ \n\ Report bugs to %s\n", progname, ZEBRA_BUG_ADDRESS); @@ -182,6 +184,7 @@ main (int argc, char **argv) char *config_file = NULL; char *progname; struct thread thread; + int dryrun = 0; /* Set umask before anything for security */ umask (0027); @@ -212,7 +215,7 @@ main (int argc, char **argv) { int opt; - opt = getopt_long (argc, argv, "dlf:i:hA:P:u:g:av", longopts, 0); + opt = getopt_long (argc, argv, "dlf:i:hA:P:u:g:avC", longopts, 0); if (opt == EOF) break; @@ -259,6 +262,9 @@ main (int argc, char **argv) print_version (progname); exit (0); break; + case 'C': + dryrun = 1; + break; case 'h': usage (progname, 0); break; @@ -303,6 +309,10 @@ main (int argc, char **argv) /* Get configuration file. */ vty_read_config (config_file, config_default); + /* Start execution only if not in dry-run mode */ + if (dryrun) + return(0); + /* Change to the daemon program. */ if (daemon_mode) daemon (0, 0); diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c index d7a35645..2addc497 100644 --- a/ospfd/ospf_packet.c +++ b/ospfd/ospf_packet.c @@ -216,8 +216,9 @@ ospf_packet_dup (struct ospf_packet *op) struct ospf_packet *new; if (stream_get_endp(op->s) != op->length) - zlog_warn ("ospf_packet_dup stream %ld ospf_packet %d size mismatch", - STREAM_SIZE(op->s), op->length); + /* XXX size_t */ + zlog_warn ("ospf_packet_dup stream %lu ospf_packet %u size mismatch", + (u_long)STREAM_SIZE(op->s), op->length); /* Reserve space for MD5 authentication that may be added later. */ new = ospf_packet_new (stream_get_endp(op->s) + OSPF_AUTH_MD5_SIZE); @@ -371,7 +372,9 @@ ospf_make_md5_digest (struct ospf_interface *oi, struct ospf_packet *op) op->length = ntohs (ospfh->length) + OSPF_AUTH_MD5_SIZE; if (stream_get_endp(op->s) != op->length) - zlog_warn("ospf_make_md5_digest: length mismatch stream %ld ospf_packet %d", stream_get_endp(op->s), op->length); + /* XXX size_t */ + zlog_warn("ospf_make_md5_digest: length mismatch stream %lu ospf_packet %u", + (u_long)stream_get_endp(op->s), op->length); return OSPF_AUTH_MD5_SIZE; } @@ -759,7 +762,7 @@ ospf_hello (struct ip *iph, struct ospf_header *ospfh, } /* If incoming interface is passive one, ignore Hello. */ - if (OSPF_IF_PARAM (oi, passive_interface) == OSPF_IF_PASSIVE) { + if (OSPF_IF_PASSIVE_STATUS (oi) == OSPF_IF_PASSIVE) { char buf[3][INET_ADDRSTRLEN]; zlog_debug ("ignoring HELLO from router %s sent to %s, " "received on a passive interface, %s", @@ -796,8 +799,10 @@ ospf_hello (struct ip *iph, struct ospf_header *ospfh, /* Compare Router Dead Interval. */ if (OSPF_IF_PARAM (oi, v_wait) != ntohl (hello->dead_interval)) { - zlog_warn ("Packet %s [Hello:RECV]: RouterDeadInterval mismatch.", - inet_ntoa (ospfh->router_id)); + zlog_warn ("Packet %s [Hello:RECV]: RouterDeadInterval mismatch " + "(expected %u, but received %u).", + inet_ntoa(ospfh->router_id), + OSPF_IF_PARAM(oi, v_wait), ntohl(hello->dead_interval)); return; } @@ -806,8 +811,10 @@ ospf_hello (struct ip *iph, struct ospf_header *ospfh, { if (OSPF_IF_PARAM (oi, v_hello) != ntohs (hello->hello_interval)) { - zlog_warn ("Packet %s [Hello:RECV]: HelloInterval mismatch.", - inet_ntoa (ospfh->router_id)); + zlog_warn ("Packet %s [Hello:RECV]: HelloInterval mismatch " + "(expected %u, but received %u).", + inet_ntoa(ospfh->router_id), + OSPF_IF_PARAM(oi, v_hello), ntohs(hello->hello_interval)); return; } } @@ -2712,25 +2719,9 @@ ospf_make_db_desc (struct ospf_interface *oi, struct ospf_neighbor *nbr, /* Set DD Sequence Number. */ stream_putl (s, nbr->dd_seqnum); + /* shortcut unneeded walk of (empty) summary LSDBs */ if (ospf_db_summary_isempty (nbr)) - { - /* Sanity check: - * - * Must be here either: - * - Initial DBD (ospf_nsm.c) - * - M must be set - * or - * - finishing Exchange, and DB-Summary list empty - * - from ospf_db_desc_proc() - * - M must not be set - */ - if (nbr->state >= NSM_Exchange) - assert (!IS_SET_DD_M(nbr->dd_flags)); - else - assert (IS_SET_DD_M(nbr->dd_flags)); - - return length; - } + goto empty; /* Describe LSA Header from Database Summary List. */ lsdb = &nbr->db_sum; @@ -2785,9 +2776,17 @@ ospf_make_db_desc (struct ospf_interface *oi, struct ospf_neighbor *nbr, /* Update 'More' bit */ if (ospf_db_summary_isempty (nbr)) { - UNSET_FLAG (nbr->dd_flags, OSPF_DD_FLAG_M); - /* Rewrite DD flags */ - stream_putc_at (s, pp, nbr->dd_flags); +empty: + if (nbr->state >= NSM_Exchange) + { + UNSET_FLAG (nbr->dd_flags, OSPF_DD_FLAG_M); + /* Rewrite DD flags */ + stream_putc_at (s, pp, nbr->dd_flags); + } + else + { + assert (IS_SET_DD_M(nbr->dd_flags)); + } } return length; } @@ -2979,7 +2978,7 @@ ospf_poll_send (struct ospf_nbr_nbma *nbr_nbma) assert(oi); /* If this is passive interface, do not send OSPF Hello. */ - if (OSPF_IF_PARAM (oi, passive_interface) == OSPF_IF_PASSIVE) + if (OSPF_IF_PASSIVE_STATUS (oi) == OSPF_IF_PASSIVE) return; if (oi->type != OSPF_IFTYPE_NBMA) @@ -3047,7 +3046,7 @@ ospf_hello_send (struct ospf_interface *oi) u_int16_t length = OSPF_HEADER_SIZE; /* If this is passive interface, do not send OSPF Hello. */ - if (OSPF_IF_PARAM (oi, passive_interface) == OSPF_IF_PASSIVE) + if (OSPF_IF_PASSIVE_STATUS (oi) == OSPF_IF_PASSIVE) return; op = ospf_packet_new (oi->ifp->mtu); diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 04e1df46..d6da11dc 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -249,19 +249,82 @@ ALIAS (no_ospf_router_id, NO_STR "router-id for the OSPF process\n") +static void +ospf_passive_interface_default (struct ospf *ospf, u_char newval) +{ + struct listnode *ln; + struct interface *ifp; + struct ospf_interface *oi; + + ospf->passive_interface_default = newval; + + for (ALL_LIST_ELEMENTS_RO (om->iflist, ln, ifp)) + { + if (ifp && + OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp), passive_interface)) + UNSET_IF_PARAM (IF_DEF_PARAMS (ifp), passive_interface); + } + for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, ln, oi)) + { + if (OSPF_IF_PARAM_CONFIGURED (oi->params, passive_interface)) + UNSET_IF_PARAM (oi->params, passive_interface); + /* update multicast memberships */ + ospf_if_set_multicast(oi); + } +} + +static void +ospf_passive_interface_update (struct ospf *ospf, struct interface *ifp, + struct in_addr addr, + struct ospf_if_params *params, u_char value) +{ + u_char dflt; + + params->passive_interface = value; + if (params != IF_DEF_PARAMS (ifp)) + { + if (OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp), passive_interface)) + dflt = IF_DEF_PARAMS (ifp)->passive_interface; + else + dflt = ospf->passive_interface_default; + + if (value != dflt) + SET_IF_PARAM (params, passive_interface); + else + UNSET_IF_PARAM (params, passive_interface); + + ospf_free_if_params (ifp, addr); + ospf_if_update_params (ifp, addr); + } + else + { + if (value != ospf->passive_interface_default) + SET_IF_PARAM (params, passive_interface); + else + UNSET_IF_PARAM (params, passive_interface); + } +} + DEFUN (ospf_passive_interface, ospf_passive_interface_addr_cmd, "passive-interface IFNAME A.B.C.D", "Suppress routing updates on an interface\n" "Interface's name\n") { - struct interface *ifp; - struct in_addr addr; - int ret; - struct ospf_if_params *params; - struct route_node *rn; + struct interface *ifp; + struct in_addr addr; + int ret; + struct ospf_if_params *params; + struct route_node *rn; + struct ospf *ospf = vty->index; + + if (argc == 0) + { + ospf_passive_interface_default (ospf, OSPF_IF_PASSIVE); + return CMD_SUCCESS; + } - ifp = if_get_by_name (argv[0]); + ifp = if_get_by_name (argv[0]); params = IF_DEF_PARAMS (ifp); @@ -278,9 +341,7 @@ DEFUN (ospf_passive_interface, params = ospf_get_if_params (ifp, addr); ospf_if_update_params (ifp, addr); } - - SET_IF_PARAM (params, passive_interface); - params->passive_interface = OSPF_IF_PASSIVE; + ospf_passive_interface_update (ospf, ifp, addr, params, OSPF_IF_PASSIVE); /* XXX We should call ospf_if_set_multicast on exactly those * interfaces for which the passive property changed. It is too much @@ -289,12 +350,13 @@ DEFUN (ospf_passive_interface, * record of joined groups to avoid systems calls if the desired * memberships match the current memership. */ + for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next (rn)) { struct ospf_interface *oi = rn->info; if (oi && (OSPF_IF_PARAM(oi, passive_interface) == OSPF_IF_PASSIVE)) - ospf_if_set_multicast(oi); + ospf_if_set_multicast(oi); } /* * XXX It is not clear what state transitions the interface needs to @@ -312,6 +374,12 @@ ALIAS (ospf_passive_interface, "Suppress routing updates on an interface\n" "Interface's name\n") +ALIAS (ospf_passive_interface, + ospf_passive_interface_default_cmd, + "passive-interface default", + "Suppress routing updates on an interface\n" + "Suppress routing updates on interfaces by default\n") + DEFUN (no_ospf_passive_interface, no_ospf_passive_interface_addr_cmd, "no passive-interface IFNAME A.B.C.D", @@ -324,6 +392,13 @@ DEFUN (no_ospf_passive_interface, struct ospf_if_params *params; int ret; struct route_node *rn; + struct ospf *ospf = vty->index; + + if (argc == 0) + { + ospf_passive_interface_default (ospf, OSPF_IF_ACTIVE); + return CMD_SUCCESS; + } ifp = if_get_by_name (argv[0]); @@ -343,15 +418,7 @@ DEFUN (no_ospf_passive_interface, if (params == NULL) return CMD_SUCCESS; } - - UNSET_IF_PARAM (params, passive_interface); - params->passive_interface = OSPF_IF_ACTIVE; - - if (params != IF_DEF_PARAMS (ifp)) - { - ospf_free_if_params (ifp, addr); - ospf_if_update_params (ifp, addr); - } + ospf_passive_interface_update (ospf, ifp, addr, params, OSPF_IF_ACTIVE); /* XXX We should call ospf_if_set_multicast on exactly those * interfaces for which the passive property changed. It is too much @@ -378,6 +445,13 @@ ALIAS (no_ospf_passive_interface, "Allow routing updates on an interface\n" "Interface's name\n") +ALIAS (no_ospf_passive_interface, + no_ospf_passive_interface_default_cmd, + "no passive-interface default", + NO_STR + "Allow routing updates on an interface\n" + "Allow routing updates on interfaces by default\n") + DEFUN (ospf_network_area, ospf_network_area_cmd, "network A.B.C.D/M area (A.B.C.D|<0-4294967295>)", @@ -2791,7 +2865,7 @@ show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf, struct in_addr *dest; const char *dstr; - if ((ifp->flags & IFF_POINTOPOINT) + if ((ifp->flags & IFF_POINTOPOINT) || oi->type == OSPF_IFTYPE_VIRTUALLINK) dstr = "Peer"; else @@ -2883,14 +2957,14 @@ show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf, OSPF_IF_PARAM (oi, retransmit_interval), VTY_NEWLINE); - if (OSPF_IF_PARAM (oi, passive_interface) == OSPF_IF_ACTIVE) + if (OSPF_IF_PASSIVE_STATUS (oi) == OSPF_IF_ACTIVE) { char timebuf[OSPF_TIME_DUMP_SIZE]; vty_out (vty, " Hello due in %s%s", ospf_timer_dump (oi->t_hello, timebuf, sizeof(timebuf)), VTY_NEWLINE); } - else /* OSPF_IF_PASSIVE is set */ + else /* passive-interface is set */ vty_out (vty, " No Hellos (Passive interface)%s", VTY_NEWLINE); vty_out (vty, " Neighbor Count is %d, Adjacent neighbor count is %d%s", @@ -7868,17 +7942,36 @@ ospf_config_write (struct vty *vty) config_write_ospf_redistribute (vty, ospf); /* passive-interface print. */ + if (ospf->passive_interface_default == OSPF_IF_PASSIVE) + vty_out (vty, " passive-interface default%s", VTY_NEWLINE); + for (ALL_LIST_ELEMENTS_RO (om->iflist, node, ifp)) - if (IF_DEF_PARAMS (ifp)->passive_interface == OSPF_IF_PASSIVE) - vty_out (vty, " passive-interface %s%s", - ifp->name, VTY_NEWLINE); - + if (OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp), passive_interface) + && IF_DEF_PARAMS (ifp)->passive_interface != + ospf->passive_interface_default) + { + vty_out (vty, " %spassive-interface %s%s", + IF_DEF_PARAMS (ifp)->passive_interface ? "" : "no ", + ifp->name, VTY_NEWLINE); + } for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) - if (OSPF_IF_PARAM_CONFIGURED (oi->params, passive_interface) && - oi->params->passive_interface == OSPF_IF_PASSIVE) - vty_out (vty, " passive-interface %s %s%s", + { + if (!OSPF_IF_PARAM_CONFIGURED (oi->params, passive_interface)) + continue; + if (OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (oi->ifp), + passive_interface)) + { + if (oi->params->passive_interface == IF_DEF_PARAMS (oi->ifp)->passive_interface) + continue; + } + else if (oi->params->passive_interface == ospf->passive_interface_default) + continue; + + vty_out (vty, " %spassive-interface %s %s%s", + oi->params->passive_interface ? "" : "no ", oi->ifp->name, inet_ntoa (oi->address->u.prefix4), VTY_NEWLINE); + } /* Network area print. */ config_write_network_area (vty, ospf); @@ -8199,8 +8292,10 @@ ospf_vty_init (void) /* "passive-interface" commands. */ install_element (OSPF_NODE, &ospf_passive_interface_addr_cmd); install_element (OSPF_NODE, &ospf_passive_interface_cmd); + install_element (OSPF_NODE, &ospf_passive_interface_default_cmd); install_element (OSPF_NODE, &no_ospf_passive_interface_addr_cmd); install_element (OSPF_NODE, &no_ospf_passive_interface_cmd); + install_element (OSPF_NODE, &no_ospf_passive_interface_default_cmd); /* "ospf abr-type" commands. */ install_element (OSPF_NODE, &ospf_abr_type_cmd); diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index 5a722e05..bdd01424 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -65,6 +65,13 @@ ospf_router_id_update_zebra (int command, struct zclient *zclient, struct prefix router_id; zebra_router_id_update_read(zclient->ibuf,&router_id); + if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE)) + { + char buf[128]; + prefix2str(&router_id, buf, sizeof(buf)); + zlog_debug("Zebra rcvd: router id update %s", buf); + } + router_id_zebra = router_id.u.prefix4; ospf = ospf_lookup (); @@ -256,6 +263,13 @@ ospf_interface_address_add (int command, struct zclient *zclient, if (c == NULL) return 0; + if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE)) + { + char buf[128]; + prefix2str(c->address, buf, sizeof(buf)); + zlog_debug("Zebra: interface %s address add %s", c->ifp->name, buf); + } + ospf = ospf_lookup (); if (ospf != NULL) ospf_if_update (ospf); @@ -283,6 +297,13 @@ ospf_interface_address_delete (int command, struct zclient *zclient, if (c == NULL) return 0; + if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE)) + { + char buf[128]; + prefix2str(c->address, buf, sizeof(buf)); + zlog_debug("Zebra: interface %s address delete %s", c->ifp->name, buf); + } + ifp = c->ifp; p = *c->address; p.prefixlen = IPV4_MAX_PREFIXLEN; @@ -470,6 +491,10 @@ ospf_zebra_add_discard (struct prefix_ipv4 *p) api.ifindex_num = 0; zapi_ipv4_route (ZEBRA_IPV4_ROUTE_ADD, zclient, p, &api); + + if (IS_DEBUG_OSPF (zebra, ZEBRA_REDISTRIBUTE)) + zlog_debug ("Zebra: Route add discard %s/%d", + inet_ntoa (p->prefix), p->prefixlen); } } @@ -576,21 +601,15 @@ int ospf_redistribute_default_set (struct ospf *ospf, int originate, int mtype, int mvalue) { - int force = 0; + ospf->default_originate = originate; + ospf->dmetric[DEFAULT_ROUTE].type = mtype; + ospf->dmetric[DEFAULT_ROUTE].value = mvalue; if (ospf_is_type_redistributed (DEFAULT_ROUTE)) { - if (mtype != ospf->dmetric[DEFAULT_ROUTE].type) - { - ospf->dmetric[DEFAULT_ROUTE].type = mtype; - force = 1; - } - if (mvalue != ospf->dmetric[DEFAULT_ROUTE].value) - { - force = 1; - ospf->dmetric[DEFAULT_ROUTE].value = mvalue; - } - + /* if ospf->default_originate changes value, is calling + ospf_external_lsa_refresh_default sufficient to implement + the change? */ ospf_external_lsa_refresh_default (ospf); if (IS_DEBUG_OSPF (zebra, ZEBRA_REDISTRIBUTE)) @@ -601,10 +620,6 @@ ospf_redistribute_default_set (struct ospf *ospf, int originate, return CMD_SUCCESS; } - ospf->default_originate = originate; - ospf->dmetric[DEFAULT_ROUTE].type = mtype; - ospf->dmetric[DEFAULT_ROUTE].value = mvalue; - zclient_redistribute_default (ZEBRA_REDISTRIBUTE_DEFAULT_ADD, zclient); if (IS_DEBUG_OSPF (zebra, ZEBRA_REDISTRIBUTE)) diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index 8c151d98..dd5af5e9 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -167,6 +167,8 @@ ospf_new (void) new->default_originate = DEFAULT_ORIGINATE_NONE; + new->passive_interface_default = OSPF_IF_ACTIVE; + new->new_external_route = route_table_init (); new->old_external_route = route_table_init (); new->external_lsas = route_table_init (); @@ -894,8 +896,6 @@ ospf_network_run (struct ospf *ospf, struct prefix *p, struct ospf_area *area) if ((ospf->router_id.s_addr != 0) && if_is_operative (ifp)) ospf_if_up (oi); - - break; } } } diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h index c15b4d39..ec9d9d6b 100644 --- a/ospfd/ospfd.h +++ b/ospfd/ospfd.h @@ -216,6 +216,7 @@ struct ospf struct ospf_area *backbone; /* Pointer to the Backbone Area. */ struct list *oiflist; /* ospf interfaces */ + u_char passive_interface_default; /* passive-interface default */ /* LSDB of AS-external-LSAs. */ struct ospf_lsdb *lsdb; |