--- quagga-0.99.9/bgpd/bgp_open.h 2007-08-06 08:17:45.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/bgpd/bgp_open.h 2008-04-16 11:55:47.000000000 -0700 @@ -44,7 +44,12 @@ struct capability_orf_entry struct { u_char type; u_char mode; +#if ( __GNUC__ == 2) + // did not compile in FreeBSD, gcc 2.95.4 + } orfs[0]; +#else } orfs[]; +#endif } __attribute__ ((packed)); #pragma pack() @@ -58,7 +63,12 @@ struct graceful_restart_af struct capability_gr { u_int16_t restart_flag_time; +#if ( __GNUC__ == 2) + // did not compile in FreeBSD, gcc 2.95.4 + struct graceful_restart_af gr[0]; +#else struct graceful_restart_af gr[]; +#endif }; /* Capability Code */ --- quagga-0.99.9/bgpd/bgp_route.c 2007-08-26 15:44:52.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/bgpd/bgp_route.c 2008-04-16 11:55:47.000000000 -0700 @@ -5802,9 +5803,16 @@ route_vty_out_tag (struct vty *vty, stru #ifdef HAVE_IPV6 else if (p->family == AF_INET6) { +/* gcc-2.95 won't let asserts before array declarations */ +#if ( __GNUC__ > 2) assert (attr->extra); +#endif char buf[BUFSIZ]; char buf1[BUFSIZ]; +/* Move it here */ +#if ( __GNUC__ == 2) + assert (attr->extra); +#endif if (attr->extra->mp_nexthop_len == 16) vty_out (vty, "%s", inet_ntop (AF_INET6, &attr->extra->mp_nexthop_global, --- quagga-0.99.9/configure 2007-09-07 09:54:55.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/configure 2008-04-16 11:55:47.000000000 -0700 @@ -728,8 +728,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='Quagga' PACKAGE_TARNAME='quagga' -PACKAGE_VERSION='0.99.9' -PACKAGE_STRING='Quagga 0.99.9' +PACKAGE_VERSION='0.99.9-ospfv3-extensions-2008-04-16' +PACKAGE_STRING='Quagga 0.99.9-ospfv3-extensions-2008-04-16' PACKAGE_BUGREPORT='http://bugzilla.quagga.net' ac_unique_file="lib/zebra.h" @@ -21323,6 +21323,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #include <$ac_header> @@ -21415,6 +21418,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif @@ -22871,6 +22877,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -22996,6 +23005,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -27698,6 +27710,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -27803,6 +27818,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -28397,6 +28415,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -29338,6 +29359,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -29481,6 +29505,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -29624,6 +29651,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -29767,6 +29797,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -29910,6 +29943,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -30053,6 +30089,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -30196,6 +30235,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -30339,6 +30381,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -30482,6 +30527,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -30625,6 +30673,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -30768,6 +30819,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -30911,6 +30965,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -31054,6 +31111,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -31199,6 +31259,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -31320,6 +31383,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -31464,6 +31530,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -31585,6 +31654,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -31729,6 +31801,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -31850,6 +31925,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -31994,6 +32072,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -32115,6 +32196,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -32259,6 +32343,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -32380,6 +32467,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -32524,6 +32614,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -32645,6 +32738,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -32791,6 +32887,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -32932,6 +33031,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -33866,6 +33968,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include @@ -34178,6 +34283,9 @@ cat >>conftest.$ac_ext <<_ACEOF #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif #if HAVE_NET_IF_H # include --- quagga-0.99.9/configure.ac 2007-09-07 09:54:01.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/configure.ac 2008-04-16 11:55:47.000000000 -0700 @@ -8,7 +8,7 @@ ## $Id: configure.ac,v 1.139 2007/09/07 16:54:01 paul Exp $ AC_PREREQ(2.53) -AC_INIT(Quagga, 0.99.9, [http://bugzilla.quagga.net]) +AC_INIT(Quagga, 0.99.9-ospfv3-extensions-2008-04-16, [http://bugzilla.quagga.net]) AC_CONFIG_SRCDIR(lib/zebra.h) dnl ----------------------------------- @@ -416,6 +416,9 @@ m4_define([QUAGGA_INCLUDES], #if HAVE_NETINET_IN_H # include #endif +#if HAVE_NET_IF_H +# include +#endif ])dnl AC_CHECK_HEADERS([sys/un.h net/if.h netinet/in_systm.h netinet/in_var.h \ --- quagga-0.99.9/lib/buffer.c 2005-12-02 03:02:17.000000000 -0800 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/buffer.c 2008-04-16 11:55:47.000000000 -0700 @@ -53,7 +53,12 @@ struct buffer_data size_t sp; /* Actual data stream (variable length). */ +#if ( __GNUC__ == 2) + // did not compile in FreeBSD, gcc 2.95.4 + unsigned char data[0]; /* real dimension is buffer->size */ +#else unsigned char data[]; /* real dimension is buffer->size */ +#endif }; /* It should always be true that: 0 <= sp <= cp <= size */ @@ -148,7 +153,8 @@ buffer_add (struct buffer *b) { struct buffer_data *d; - d = XMALLOC(MTYPE_BUFFER_DATA, offsetof(struct buffer_data, data[b->size])); + d = + XMALLOC (MTYPE_BUFFER_DATA, offsetof (struct buffer_data, data[b->size])); d->cp = d->sp = 0; d->next = NULL; @@ -237,7 +243,8 @@ buffer_flush_window (struct buffer *b, i char more[] = " --More-- "; char erase[] = { 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08}; + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 + }; struct buffer_data *data; int column; @@ -314,7 +321,8 @@ buffer_flush_window (struct buffer *b, i { zlog_warn("%s: growing iov array to %d; " "width %d, height %d, size %lu", - __func__, iov_alloc, width, height, (u_long)b->size); + __func__, iov_alloc, width, height, + (u_long) b->size); iov = XREALLOC(MTYPE_TMP, iov, iov_alloc*sizeof(*iov)); } else --- quagga-0.99.9/lib/buffer.h 2005-05-03 12:05:50.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/buffer.h 2008-04-16 11:55:47.000000000 -0700 @@ -96,7 +96,8 @@ extern buffer_status_t buffer_flush_all to return -1 (because the logic for handling the erase and more features is too complicated to retry the write later). */ -extern buffer_status_t buffer_flush_window (struct buffer *, int fd, int width, - int height, int erase, int no_more); +extern buffer_status_t buffer_flush_window (struct buffer *, int fd, + int width, int height, int erase, + int no_more); #endif /* _ZEBRA_BUFFER_H */ --- quagga-0.99.9/lib/checksum.c 2005-11-03 03:52:14.000000000 -0800 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/checksum.c 2008-04-16 11:55:47.000000000 -0700 @@ -24,13 +24,15 @@ in_cksum(void *parg, int nbytes) */ sum = 0; - while (nbytes > 1) { + while (nbytes > 1) + { sum += *ptr++; nbytes -= 2; } /* mop up an odd byte, if necessary */ - if (nbytes == 1) { + if (nbytes == 1) + { oddbyte = 0; /* make sure top half is zero */ *((u_char *) &oddbyte) = *(u_char *)ptr; /* one byte only */ sum += oddbyte; --- quagga-0.99.9/lib/command.c 2007-04-29 05:40:39.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/command.c 2008-04-16 11:55:47.000000000 -0700 @@ -41,74 +41,88 @@ vector cmdvec = NULL; struct host host; /* Standard command node structures. */ -struct cmd_node auth_node = -{ +struct cmd_node auth_node = { AUTH_NODE, "Password: ", }; -struct cmd_node view_node = -{ +struct cmd_node view_node = { VIEW_NODE, "%s> ", }; -struct cmd_node auth_enable_node = -{ +struct cmd_node auth_enable_node = { AUTH_ENABLE_NODE, "Password: ", }; -struct cmd_node enable_node = -{ +struct cmd_node enable_node = { ENABLE_NODE, "%s# ", }; -struct cmd_node config_node = -{ +struct cmd_node config_node = { CONFIG_NODE, "%s(config)# ", 1 }; /* Default motd string. */ -const char *default_motd = -"\r\n\ +const char *default_motd = "\r\n\ Hello, this is " QUAGGA_PROGNAME " (version " QUAGGA_VERSION ").\r\n\ " QUAGGA_COPYRIGHT "\r\n\ \r\n"; -static struct facility_map { +static struct facility_map +{ int facility; const char *name; size_t match; } syslog_facilities[] = { - { LOG_KERN, "kern", 1 }, - { LOG_USER, "user", 2 }, - { LOG_MAIL, "mail", 1 }, - { LOG_DAEMON, "daemon", 1 }, - { LOG_AUTH, "auth", 1 }, - { LOG_SYSLOG, "syslog", 1 }, - { LOG_LPR, "lpr", 2 }, - { LOG_NEWS, "news", 1 }, - { LOG_UUCP, "uucp", 2 }, - { LOG_CRON, "cron", 1 }, + { + LOG_KERN, "kern", 1}, + { + LOG_USER, "user", 2}, + { + LOG_MAIL, "mail", 1}, + { + LOG_DAEMON, "daemon", 1}, + { + LOG_AUTH, "auth", 1}, + { + LOG_SYSLOG, "syslog", 1}, + { + LOG_LPR, "lpr", 2}, + { + LOG_NEWS, "news", 1}, + { + LOG_UUCP, "uucp", 2}, + { + LOG_CRON, "cron", 1}, #ifdef LOG_FTP - { LOG_FTP, "ftp", 1 }, + { + LOG_FTP, "ftp", 1}, #endif - { LOG_LOCAL0, "local0", 6 }, - { LOG_LOCAL1, "local1", 6 }, - { LOG_LOCAL2, "local2", 6 }, - { LOG_LOCAL3, "local3", 6 }, - { LOG_LOCAL4, "local4", 6 }, - { LOG_LOCAL5, "local5", 6 }, - { LOG_LOCAL6, "local6", 6 }, - { LOG_LOCAL7, "local7", 6 }, - { 0, NULL, 0 }, - }; + { + LOG_LOCAL0, "local0", 6}, + { + LOG_LOCAL1, "local1", 6}, + { + LOG_LOCAL2, "local2", 6}, + { + LOG_LOCAL3, "local3", 6}, + { + LOG_LOCAL4, "local4", 6}, + { + LOG_LOCAL5, "local5", 6}, + { + LOG_LOCAL6, "local6", 6}, + { + LOG_LOCAL7, "local7", 6}, + { +0, NULL, 0},}; static const char * facility_name(int facility) @@ -181,8 +195,7 @@ argv_concat (const char **argv, int argc /* Install top node of command vector. */ void -install_node (struct cmd_node *node, - int (*func) (struct vty *)) +install_node (struct cmd_node *node, int (*func) (struct vty *)) { vector_set_index (cmdvec, node->node, node); node->func = func; @@ -402,7 +415,9 @@ cmd_make_descvec (const char *string, co sp = cp; - while (! (isspace ((int) *cp) || *cp == '\r' || *cp == '\n' || *cp == ')' || *cp == '|') && *cp != '\0') + while (! + (isspace ((int) *cp) || *cp == '\r' || *cp == '\n' || *cp == ')' + || *cp == '|') && *cp != '\0') cp++; len = cp - sp; @@ -536,7 +551,8 @@ config_write_host (struct vty *vty) if (host.password_encrypt) vty_out (vty, "password 8 %s%s", host.password_encrypt, VTY_NEWLINE); if (host.enable_encrypt) - vty_out (vty, "enable password 8 %s%s", host.enable_encrypt, VTY_NEWLINE); + vty_out (vty, "enable password 8 %s%s", host.enable_encrypt, + VTY_NEWLINE); } else { @@ -574,9 +590,11 @@ config_write_host (struct vty *vty) if (zlog_default->maxlvl[ZLOG_DEST_MONITOR] == ZLOG_DISABLED) vty_out(vty,"no log monitor%s",VTY_NEWLINE); - else if (zlog_default->maxlvl[ZLOG_DEST_MONITOR] != zlog_default->default_lvl) + else if (zlog_default->maxlvl[ZLOG_DEST_MONITOR] != + zlog_default->default_lvl) vty_out(vty,"log monitor %s%s", - zlog_priority[zlog_default->maxlvl[ZLOG_DEST_MONITOR]],VTY_NEWLINE); + zlog_priority[zlog_default->maxlvl[ZLOG_DEST_MONITOR]], + VTY_NEWLINE); if (zlog_default->maxlvl[ZLOG_DEST_SYSLOG] != ZLOG_DISABLED) { @@ -605,8 +623,7 @@ config_write_host (struct vty *vty) vty_out (vty, "service password-encryption%s", VTY_NEWLINE); if (host.lines >= 0) - vty_out (vty, "service terminal-length %d%s", host.lines, - VTY_NEWLINE); + vty_out (vty, "service terminal-length %d%s", host.lines, VTY_NEWLINE); if (host.motdfile) vty_out (vty, "banner motd file %s%s", host.motdfile, VTY_NEWLINE); @@ -638,7 +655,9 @@ cmd_filter_by_symbol (char *command, cha lim = strlen (command); while (i < lim) { - if (! (isdigit ((int) command[i]) || command[i] == '.' || command[i] == '/')) + if (! + (isdigit ((int) command[i]) || command[i] == '.' + || command[i] == '/')) return 1; i++; } @@ -650,7 +669,9 @@ cmd_filter_by_symbol (char *command, cha lim = strlen (command); while (i < lim) { - if (! (isalpha ((int) command[i]) || command[i] == '_' || command[i] == '-')) + if (! + (isalpha ((int) command[i]) || command[i] == '_' + || command[i] == '-')) return 1; i++; } @@ -1557,13 +1578,13 @@ desc_unique_string (vector v, const char } static int -cmd_try_do_shortcut (enum node_type node, char* first_word) { +cmd_try_do_shortcut (enum node_type node, char *first_word) +{ if ( first_word != NULL && node != AUTH_NODE && node != VIEW_NODE && node != AUTH_ENABLE_NODE && - node != ENABLE_NODE && - 0 == strcmp( "do", first_word ) ) + node != ENABLE_NODE && 0 == strcmp ("do", first_word)) return 1; return 0; } @@ -1616,7 +1637,8 @@ cmd_describe_command_real (vector vline, && (vector_active (cmd_element->strvec))) { descvec = vector_slot (cmd_element->strvec, - vector_active (cmd_element->strvec) - 1); + vector_active (cmd_element->strvec) - + 1); for (k = 0; k < vector_active (descvec); k++) { struct desc *desc = vector_slot (descvec, k); @@ -1725,7 +1747,8 @@ cmd_describe_command (vector vline, stru /* use memcpy? */ for (index = 1; index < vector_active (vline); index++) { - vector_set_index (shifted_vline, index-1, vector_lookup(vline, index)); + vector_set_index (shifted_vline, index - 1, + vector_lookup (vline, index)); } ret = cmd_describe_command_real (shifted_vline, vty, status); @@ -1948,7 +1971,8 @@ cmd_complete_command (vector vline, stru /* use memcpy? */ for (index = 1; index < vector_active (vline); index++) { - vector_set_index (shifted_vline, index-1, vector_lookup(vline, index)); + vector_set_index (shifted_vline, index - 1, + vector_lookup (vline, index)); } ret = cmd_complete_command_real (shifted_vline, vty, status); @@ -2090,7 +2114,8 @@ cmd_execute_command_real (vector vline, if (CMD_VARARG (desc->cmd)) varflag = 1; - if (varflag || CMD_VARIABLE (desc->cmd) || CMD_OPTION (desc->cmd)) + if (varflag || CMD_VARIABLE (desc->cmd) + || CMD_OPTION (desc->cmd)) argv[argc++] = vector_slot (vline, i); } else @@ -2114,7 +2139,8 @@ cmd_execute_command_real (vector vline, int cmd_execute_command (vector vline, struct vty *vty, struct cmd_element **cmd, - int vtysh) { + int vtysh) +{ int ret, saved_ret, tried = 0; enum node_type onode, try_node; @@ -2132,7 +2158,8 @@ cmd_execute_command (vector vline, struc /* use memcpy? */ for (index = 1; index < vector_active (vline); index++) { - vector_set_index (shifted_vline, index-1, vector_lookup(vline, index)); + vector_set_index (shifted_vline, index - 1, + vector_lookup (vline, index)); } ret = cmd_execute_command_real (shifted_vline, vty, cmd); @@ -2149,8 +2176,7 @@ cmd_execute_command (vector vline, struc return saved_ret; /* This assumes all nodes above CONFIG_NODE are childs of CONFIG_NODE */ - while ( ret != CMD_SUCCESS && ret != CMD_WARNING - && vty->node > CONFIG_NODE ) + while (ret != CMD_SUCCESS && ret != CMD_WARNING && vty->node > CONFIG_NODE) { try_node = node_parent(try_node); vty->node = try_node; @@ -2266,7 +2292,8 @@ cmd_execute_command_strict (vector vline if (CMD_VARARG (desc->cmd)) varflag = 1; - if (varflag || CMD_VARIABLE (desc->cmd) || CMD_OPTION (desc->cmd)) + if (varflag || CMD_VARIABLE (desc->cmd) + || CMD_OPTION (desc->cmd)) argv[argc++] = vector_slot (vline, i); } else @@ -2326,14 +2353,14 @@ config_from_file (struct vty *vty, FILE DEFUN (config_terminal, config_terminal_cmd, "configure terminal", - "Configuration from vty interface\n" - "Configuration terminal\n") + "Configuration from vty interface\n" "Configuration terminal\n") { if (vty_config_lock (vty)) vty->node = CONFIG_NODE; else { - vty_out (vty, "VTY configuration is locked by other VTY%s", VTY_NEWLINE); + vty_out (vty, "VTY configuration is locked by other VTY%s", + VTY_NEWLINE); return CMD_WARNING; } return CMD_SUCCESS; @@ -2341,9 +2368,7 @@ DEFUN (config_terminal, /* Enable command */ DEFUN (enable, - config_enable_cmd, - "enable", - "Turn on privileged mode command\n") + config_enable_cmd, "enable", "Turn on privileged mode command\n") { /* If enable password is NULL, change to ENABLE_NODE */ if ((host.enable == NULL && host.enable_encrypt == NULL) || @@ -2357,9 +2382,7 @@ DEFUN (enable, /* Disable command */ DEFUN (disable, - config_disable_cmd, - "disable", - "Turn off privileged mode command\n") + config_disable_cmd, "disable", "Turn off privileged mode command\n") { if (vty->node == ENABLE_NODE) vty->node = VIEW_NODE; @@ -2369,8 +2392,7 @@ DEFUN (disable, /* Down vty node level. */ DEFUN (config_exit, config_exit_cmd, - "exit", - "Exit current mode and down to previous mode\n") + "exit", "Exit current mode and down to previous mode\n") { switch (vty->node) { @@ -2418,14 +2440,10 @@ DEFUN (config_exit, /* quit is alias of exit. */ ALIAS (config_exit, config_quit_cmd, - "quit", - "Exit current mode and down to previous mode\n") - + "quit", "Exit current mode and down to previous mode\n") /* End of configuration. */ DEFUN (config_end, - config_end_cmd, - "end", - "End current mode and change to enable mode.") + config_end_cmd, "end", "End current mode and change to enable mode.") { switch (vty->node) { @@ -2463,13 +2481,10 @@ DEFUN (config_end, /* Show version. */ DEFUN (show_version, - show_version_cmd, - "show version", - SHOW_STR - "Displays zebra version\n") + show_version_cmd, "show version", SHOW_STR "Displays zebra version\n") { - vty_out (vty, "Quagga %s (%s).%s", QUAGGA_VERSION, host.name?host.name:"", - VTY_NEWLINE); + vty_out (vty, "Quagga %s (%s).%s", QUAGGA_VERSION, + host.name ? host.name : "", VTY_NEWLINE); vty_out (vty, "%s%s", QUAGGA_COPYRIGHT, VTY_NEWLINE); return CMD_SUCCESS; @@ -2478,8 +2493,7 @@ DEFUN (show_version, /* Help display function for all node. */ DEFUN (config_help, config_help_cmd, - "help", - "Description of the interactive help system\n") + "help", "Description of the interactive help system\n") { vty_out (vty, "Quagga VTY provides advanced help feature. When you need help,%s\ @@ -2493,17 +2507,12 @@ command argument (e.g. 'show ?') and des argument.%s\ 2. Partial help is provided when an abbreviated argument is entered%s\ and you want to know what arguments match the input%s\ - (e.g. 'show me?'.)%s%s", VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, - VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, - VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); + (e.g. 'show me?'.)%s%s", VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); return CMD_SUCCESS; } /* Help display function for all node. */ -DEFUN (config_list, - config_list_cmd, - "list", - "Print command list\n") +DEFUN (config_list, config_list_cmd, "list", "Print command list\n") { unsigned int i; struct cmd_node *cnode = vector_slot (cmdvec, vty->node); @@ -2513,8 +2522,7 @@ DEFUN (config_list, if ((cmd = vector_slot (cnode->cmd_vector, i)) != NULL && !(cmd->attr == CMD_ATTR_DEPRECATED || cmd->attr == CMD_ATTR_HIDDEN)) - vty_out (vty, " %s%s", cmd->string, - VTY_NEWLINE); + vty_out (vty, " %s%s", cmd->string, VTY_NEWLINE); return CMD_SUCCESS; } @@ -2584,14 +2592,14 @@ DEFUN (config_write_file, if (unlink (config_file_sav) != 0) if (errno != ENOENT) { - vty_out (vty, "Can't unlink backup configuration file %s.%s", config_file_sav, - VTY_NEWLINE); + vty_out (vty, "Can't unlink backup configuration file %s.%s", + config_file_sav, VTY_NEWLINE); goto finished; } if (link (config_file, config_file_sav) != 0) { - vty_out (vty, "Can't backup old configuration file %s.%s", config_file_sav, - VTY_NEWLINE); + vty_out (vty, "Can't backup old configuration file %s.%s", + config_file_sav, VTY_NEWLINE); goto finished; } sync (); @@ -2616,8 +2624,7 @@ DEFUN (config_write_file, goto finished; } - vty_out (vty, "Configuration saved to %s%s", config_file, - VTY_NEWLINE); + vty_out (vty, "Configuration saved to %s%s", config_file, VTY_NEWLINE); ret = CMD_SUCCESS; finished: @@ -2666,8 +2670,7 @@ DEFUN (config_write_terminal, } else { - vty_out (vty, "%sCurrent configuration:%s", VTY_NEWLINE, - VTY_NEWLINE); + vty_out (vty, "%sCurrent configuration:%s", VTY_NEWLINE, VTY_NEWLINE); vty_out (vty, "!%s", VTY_NEWLINE); for (i = 0; i < vector_active (cmdvec); i++) @@ -2684,16 +2687,11 @@ DEFUN (config_write_terminal, /* Write current configuration into the terminal. */ ALIAS (config_write_terminal, show_running_config_cmd, - "show running-config", - SHOW_STR - "running configuration\n") - + "show running-config", SHOW_STR "running configuration\n") /* Write startup configuration into the terminal. */ DEFUN (show_startup_config, show_startup_config_cmd, - "show startup-config", - SHOW_STR - "Contentes of startup configuration\n") + "show startup-config", SHOW_STR "Contentes of startup configuration\n") { char buf[BUFSIZ]; FILE *confp; @@ -2726,12 +2724,12 @@ DEFUN (show_startup_config, DEFUN (config_hostname, hostname_cmd, "hostname WORD", - "Set system's network name\n" - "This system's network name\n") + "Set system's network name\n" "This system's network name\n") { if (!isalpha((int) *argv[0])) { - vty_out (vty, "Please specify string starting with alphabet%s", VTY_NEWLINE); + vty_out (vty, "Please specify string starting with alphabet%s", + VTY_NEWLINE); return CMD_WARNING; } @@ -2745,9 +2743,7 @@ DEFUN (config_hostname, DEFUN (config_no_hostname, no_hostname_cmd, "no hostname [HOSTNAME]", - NO_STR - "Reset system's network name\n" - "Host name of this router\n") + NO_STR "Reset system's network name\n" "Host name of this router\n") { if (host.name) XFREE (MTYPE_HOST, host.name); @@ -2760,8 +2756,7 @@ DEFUN (config_password, password_cmd, "password (8|) WORD", "Assign the terminal connection password\n" "Specifies a HIDDEN password will follow\n" - "dummy string \n" - "The HIDDEN line password string\n") + "dummy string \n" "The HIDDEN line password string\n") { /* Argument check. */ if (argc == 0) @@ -2792,7 +2787,8 @@ DEFUN (config_password, password_cmd, if (!isalnum ((int) *argv[0])) { vty_out (vty, - "Please specify string starting with alphanumeric%s", VTY_NEWLINE); + "Please specify string starting with alphanumeric%s", + VTY_NEWLINE); return CMD_WARNING; } @@ -2823,8 +2818,7 @@ DEFUN (config_enable_password, enable_pa "Modify enable password parameters\n" "Assign the privileged level password\n" "Specifies a HIDDEN password will follow\n" - "dummy string \n" - "The HIDDEN 'enable' password string\n") + "dummy string \n" "The HIDDEN 'enable' password string\n") { /* Argument check. */ if (argc == 0) @@ -2858,7 +2852,8 @@ DEFUN (config_enable_password, enable_pa if (!isalnum ((int) *argv[0])) { vty_out (vty, - "Please specify string starting with alphanumeric%s", VTY_NEWLINE); + "Please specify string starting with alphanumeric%s", + VTY_NEWLINE); return CMD_WARNING; } @@ -2907,8 +2901,7 @@ DEFUN (no_config_enable_password, no_ena DEFUN (service_password_encrypt, service_password_encrypt_cmd, "service password-encryption", - "Set up miscellaneous service\n" - "Enable encrypted passwords\n") + "Set up miscellaneous service\n" "Enable encrypted passwords\n") { if (host.encrypt) return CMD_SUCCESS; @@ -2934,9 +2927,7 @@ DEFUN (service_password_encrypt, DEFUN (no_service_password_encrypt, no_service_password_encrypt_cmd, "no service password-encryption", - NO_STR - "Set up miscellaneous service\n" - "Enable encrypted passwords\n") + NO_STR "Set up miscellaneous service\n" "Enable encrypted passwords\n") { if (! host.encrypt) return CMD_SUCCESS; @@ -2977,8 +2968,7 @@ DEFUN (config_terminal_length, config_te DEFUN (config_terminal_no_length, config_terminal_no_length_cmd, "terminal no length", "Set terminal line parameters\n" - NO_STR - "Set number of lines on a screen\n") + NO_STR "Set number of lines on a screen\n") { vty->lines = -1; return CMD_SUCCESS; @@ -3018,13 +3008,13 @@ DEFUN (no_service_terminal_length, no_se DEFUN_HIDDEN (do_echo, echo_cmd, "echo .MESSAGE", - "Echo a message back to the vty\n" - "The message to echo\n") + "Echo a message back to the vty\n" "The message to echo\n") { char *message; - vty_out (vty, "%s%s", ((message = argv_concat(argv, argc, 0)) ? message : ""), - VTY_NEWLINE); + vty_out (vty, "%s%s", + ((message = + argv_concat (argv, argc, 0)) ? message : ""), VTY_NEWLINE); if (message) XFREE(MTYPE_TMP, message); return CMD_SUCCESS; @@ -3034,8 +3024,7 @@ DEFUN (config_logmsg, config_logmsg_cmd, "logmsg "LOG_LEVELS" .MESSAGE", "Send a message to enabled logging destinations\n" - LOG_LEVEL_DESC - "The message to send\n") + LOG_LEVEL_DESC "The message to send\n") { int level; char *message; @@ -3043,7 +3032,8 @@ DEFUN (config_logmsg, if ((level = level_match(argv[0])) == ZLOG_DISABLED) return CMD_ERR_NO_MATCH; - zlog(NULL, level, ((message = argv_concat(argv, argc, 1)) ? message : "")); + zlog (NULL, level, + ((message = argv_concat (argv, argc, 1)) ? message : "")); if (message) XFREE(MTYPE_TMP, message); return CMD_SUCCESS; @@ -3051,9 +3041,7 @@ DEFUN (config_logmsg, DEFUN (show_logging, show_logging_cmd, - "show logging", - SHOW_STR - "Show current logging configuration\n") + "show logging", SHOW_STR "Show current logging configuration\n") { struct zlog *zl = zlog_default; @@ -3070,26 +3058,22 @@ DEFUN (show_logging, if (zl->maxlvl[ZLOG_DEST_STDOUT] == ZLOG_DISABLED) vty_out (vty, "disabled"); else - vty_out (vty, "level %s", - zlog_priority[zl->maxlvl[ZLOG_DEST_STDOUT]]); + vty_out (vty, "level %s", zlog_priority[zl->maxlvl[ZLOG_DEST_STDOUT]]); vty_out (vty, "%s", VTY_NEWLINE); vty_out (vty, "Monitor logging: "); if (zl->maxlvl[ZLOG_DEST_MONITOR] == ZLOG_DISABLED) vty_out (vty, "disabled"); else - vty_out (vty, "level %s", - zlog_priority[zl->maxlvl[ZLOG_DEST_MONITOR]]); + vty_out (vty, "level %s", zlog_priority[zl->maxlvl[ZLOG_DEST_MONITOR]]); vty_out (vty, "%s", VTY_NEWLINE); vty_out (vty, "File logging: "); - if ((zl->maxlvl[ZLOG_DEST_FILE] == ZLOG_DISABLED) || - !zl->fp) + if ((zl->maxlvl[ZLOG_DEST_FILE] == ZLOG_DISABLED) || !zl->fp) vty_out (vty, "disabled"); else vty_out (vty, "level %s, filename %s", - zlog_priority[zl->maxlvl[ZLOG_DEST_FILE]], - zl->filename); + zlog_priority[zl->maxlvl[ZLOG_DEST_FILE]], zl->filename); vty_out (vty, "%s", VTY_NEWLINE); vty_out (vty, "Protocol name: %s%s", @@ -3104,9 +3088,7 @@ DEFUN (show_logging, DEFUN (config_log_stdout, config_log_stdout_cmd, - "log stdout", - "Logging control\n" - "Set stdout logging level\n") + "log stdout", "Logging control\n" "Set stdout logging level\n") { zlog_set_level (NULL, ZLOG_DEST_STDOUT, zlog_default->default_lvl); return CMD_SUCCESS; @@ -3115,9 +3097,7 @@ DEFUN (config_log_stdout, DEFUN (config_log_stdout_level, config_log_stdout_level_cmd, "log stdout "LOG_LEVELS, - "Logging control\n" - "Set stdout logging level\n" - LOG_LEVEL_DESC) + "Logging control\n" "Set stdout logging level\n" LOG_LEVEL_DESC) { int level; @@ -3131,9 +3111,7 @@ DEFUN (no_config_log_stdout, no_config_log_stdout_cmd, "no log stdout [LEVEL]", NO_STR - "Logging control\n" - "Cancel logging to stdout\n" - "Logging level\n") + "Logging control\n" "Cancel logging to stdout\n" "Logging level\n") { zlog_set_level (NULL, ZLOG_DEST_STDOUT, ZLOG_DISABLED); return CMD_SUCCESS; @@ -3142,8 +3120,7 @@ DEFUN (no_config_log_stdout, DEFUN (config_log_monitor, config_log_monitor_cmd, "log monitor", - "Logging control\n" - "Set terminal line (monitor) logging level\n") + "Logging control\n" "Set terminal line (monitor) logging level\n") { zlog_set_level (NULL, ZLOG_DEST_MONITOR, zlog_default->default_lvl); return CMD_SUCCESS; @@ -3153,8 +3130,7 @@ DEFUN (config_log_monitor_level, config_log_monitor_level_cmd, "log monitor "LOG_LEVELS, "Logging control\n" - "Set terminal line (monitor) logging level\n" - LOG_LEVEL_DESC) + "Set terminal line (monitor) logging level\n" LOG_LEVEL_DESC) { int level; @@ -3169,8 +3145,7 @@ DEFUN (no_config_log_monitor, "no log monitor [LEVEL]", NO_STR "Logging control\n" - "Disable terminal line (monitor) logging\n" - "Logging level\n") + "Disable terminal line (monitor) logging\n" "Logging level\n") { zlog_set_level (NULL, ZLOG_DEST_MONITOR, ZLOG_DISABLED); return CMD_SUCCESS; @@ -3229,9 +3204,7 @@ set_log_file(struct vty *vty, const char DEFUN (config_log_file, config_log_file_cmd, "log file FILENAME", - "Logging control\n" - "Logging to file\n" - "Logging filename\n") + "Logging control\n" "Logging to file\n" "Logging filename\n") { return set_log_file(vty, argv[0], zlog_default->default_lvl); } @@ -3240,9 +3213,7 @@ DEFUN (config_log_file_level, config_log_file_level_cmd, "log file FILENAME "LOG_LEVELS, "Logging control\n" - "Logging to file\n" - "Logging filename\n" - LOG_LEVEL_DESC) + "Logging to file\n" "Logging filename\n" LOG_LEVEL_DESC) { int level; @@ -3255,9 +3226,7 @@ DEFUN (no_config_log_file, no_config_log_file_cmd, "no log file [FILENAME]", NO_STR - "Logging control\n" - "Cancel logging to file\n" - "Logging file name\n") + "Logging control\n" "Cancel logging to file\n" "Logging file name\n") { zlog_reset_file (NULL); @@ -3277,12 +3246,9 @@ ALIAS (no_config_log_file, "Cancel logging to file\n" "Logging file name\n" "Logging level\n") - DEFUN (config_log_syslog, config_log_syslog_cmd, - "log syslog", - "Logging control\n" - "Set syslog logging level\n") + "log syslog", "Logging control\n" "Set syslog logging level\n") { zlog_set_level (NULL, ZLOG_DEST_SYSLOG, zlog_default->default_lvl); return CMD_SUCCESS; @@ -3291,9 +3257,7 @@ DEFUN (config_log_syslog, DEFUN (config_log_syslog_level, config_log_syslog_level_cmd, "log syslog "LOG_LEVELS, - "Logging control\n" - "Set syslog logging level\n" - LOG_LEVEL_DESC) + "Logging control\n" "Set syslog logging level\n" LOG_LEVEL_DESC) { int level; @@ -3325,9 +3289,7 @@ DEFUN (no_config_log_syslog, no_config_log_syslog_cmd, "no log syslog [LEVEL]", NO_STR - "Logging control\n" - "Cancel logging to syslog\n" - "Logging level\n") + "Logging control\n" "Cancel logging to syslog\n" "Logging level\n") { zlog_set_level (NULL, ZLOG_DEST_SYSLOG, ZLOG_DISABLED); return CMD_SUCCESS; @@ -3346,8 +3307,7 @@ DEFUN (config_log_facility, config_log_facility_cmd, "log facility "LOG_FACILITIES, "Logging control\n" - "Facility parameter for syslog messages\n" - LOG_FACILITY_DESC) + "Facility parameter for syslog messages\n" LOG_FACILITY_DESC) { int facility; @@ -3362,8 +3322,7 @@ DEFUN (no_config_log_facility, "no log facility [FACILITY]", NO_STR "Logging control\n" - "Reset syslog facility to default (daemon)\n" - "Syslog facility\n") + "Reset syslog facility to default (daemon)\n" "Syslog facility\n") { zlog_default->facility = LOG_DAEMON; return CMD_SUCCESS; @@ -3394,8 +3353,7 @@ DEFUN_DEPRECATED (no_config_log_trap, "no log trap [LEVEL]", NO_STR "Logging control\n" - "Permit all logging information\n" - "Logging level\n") + "Permit all logging information\n" "Logging level\n") { zlog_default->default_lvl = LOG_DEBUG; return CMD_SUCCESS; @@ -3427,8 +3385,7 @@ DEFUN (config_log_timestamp_precision, "log timestamp precision <0-6>", "Logging control\n" "Timestamp configuration\n" - "Set the timestamp precision\n" - "Number of subsecond digits\n") + "Set the timestamp precision\n" "Number of subsecond digits\n") { if (argc != 1) { @@ -3456,10 +3413,7 @@ DEFUN (no_config_log_timestamp_precision DEFUN (banner_motd_file, banner_motd_file_cmd, "banner motd file [FILE]", - "Set banner\n" - "Banner for motd\n" - "Banner from a file\n" - "Filename\n") + "Set banner\n" "Banner for motd\n" "Banner from a file\n" "Filename\n") { if (host.motdfile) XFREE (MTYPE_HOST, host.motdfile); @@ -3471,9 +3425,7 @@ DEFUN (banner_motd_file, DEFUN (banner_motd_default, banner_motd_default_cmd, "banner motd default", - "Set banner string\n" - "Strings for motd\n" - "Default string\n") + "Set banner string\n" "Strings for motd\n" "Default string\n") { host.motd = default_motd; return CMD_SUCCESS; @@ -3481,10 +3433,7 @@ DEFUN (banner_motd_default, DEFUN (no_banner_motd, no_banner_motd_cmd, - "no banner motd", - NO_STR - "Set banner string\n" - "Strings for motd\n") + "no banner motd", NO_STR "Set banner string\n" "Strings for motd\n") { host.motd = NULL; if (host.motdfile) --- quagga-0.99.9/lib/command.h 2007-05-02 08:28:32.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/command.h 2008-04-16 11:55:47.000000000 -0700 @@ -342,8 +343,10 @@ extern char **cmd_complete_command (vect extern const char *cmd_prompt (enum node_type); extern int config_from_file (struct vty *, FILE *); extern enum node_type node_parent (enum node_type); -extern int cmd_execute_command (vector, struct vty *, struct cmd_element **, int); -extern int cmd_execute_command_strict (vector, struct vty *, struct cmd_element **); +extern int cmd_execute_command (vector, struct vty *, struct cmd_element **, + int); +extern int cmd_execute_command_strict (vector, struct vty *, + struct cmd_element **); extern void config_replace_string (struct cmd_element *, char *, ...); extern void cmd_init (int); --- quagga-0.99.9/lib/distribute.c 2005-05-06 07:43:13.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/distribute.c 2008-04-16 11:55:47.000000000 -0700 @@ -385,8 +383,7 @@ DEFUN (distribute_list, "Filter networks in routing updates\n" "Access-list name\n" "Filter incoming routing updates\n" - "Filter outgoing routing updates\n" - "Interface name\n") + "Filter outgoing routing updates\n" "Interface name\n") { enum distribute_type type; struct distribute *dist; @@ -398,7 +395,8 @@ DEFUN (distribute_list, type = DISTRIBUTE_OUT; else { - vty_out (vty, "distribute list direction must be [in|out]%s", VTY_NEWLINE); + vty_out (vty, "distribute list direction must be [in|out]%s", + VTY_NEWLINE); return CMD_WARNING; } @@ -423,8 +420,7 @@ DEFUN (no_districute_list, no_distribute "Filter networks in routing updates\n" "Access-list name\n" "Filter incoming routing updates\n" - "Filter outgoing routing updates\n" - "Interface name\n") + "Filter outgoing routing updates\n" "Interface name\n") { int ret; enum distribute_type type; @@ -436,7 +432,8 @@ DEFUN (no_districute_list, no_distribute type = DISTRIBUTE_OUT; else { - vty_out (vty, "distribute list direction must be [in|out]%s", VTY_NEWLINE); + vty_out (vty, "distribute list direction must be [in|out]%s", + VTY_NEWLINE); return CMD_WARNING; } @@ -547,8 +541,7 @@ DEFUN (districute_list_prefix, distribut "Filter prefixes in routing updates\n" "Name of an IP prefix-list\n" "Filter incoming routing updates\n" - "Filter outgoing routing updates\n" - "Interface name\n") + "Filter outgoing routing updates\n" "Interface name\n") { enum distribute_type type; struct distribute *dist; @@ -587,8 +579,7 @@ DEFUN (no_districute_list_prefix, no_dis "Filter prefixes in routing updates\n" "Name of an IP prefix-list\n" "Filter incoming routing updates\n" - "Filter outgoing routing updates\n" - "Interface name\n") + "Filter outgoing routing updates\n" "Interface name\n") { int ret; enum distribute_type type; @@ -621,11 +612,8 @@ ALIAS (no_districute_list_prefix, no_ipv "Filter prefixes in routing updates\n" "Name of an IP prefix-list\n" "Filter incoming routing updates\n" - "Filter outgoing routing updates\n" - "Interface name\n") - -int -config_show_distribute (struct vty *vty) + "Filter outgoing routing updates\n" "Interface name\n") + int config_show_distribute (struct vty *vty) { unsigned int i; struct hash_backet *mp; @@ -645,7 +633,9 @@ config_show_distribute (struct vty *vty) vty_out (vty, "%s", VTY_NEWLINE); } else - vty_out (vty, " Outgoing update filter list for all interface is not set%s", VTY_NEWLINE); + vty_out (vty, + " Outgoing update filter list for all interface is not set%s", + VTY_NEWLINE); for (i = 0; i < disthash->size; i++) for (mp = disthash->index[i]; mp; mp = mp->next) @@ -680,7 +670,9 @@ config_show_distribute (struct vty *vty) vty_out (vty, "%s", VTY_NEWLINE); } else - vty_out (vty, " Incoming update filter list for all interface is not set%s", VTY_NEWLINE); + vty_out (vty, + " Incoming update filter list for all interface is not set%s", + VTY_NEWLINE); for (i = 0; i < disthash->size; i++) for (mp = disthash->index[i]; mp; mp = mp->next) @@ -721,8 +713,7 @@ config_write_distribute (struct vty *vty { vty_out (vty, " distribute-list %s in %s%s", dist->list[DISTRIBUTE_IN], - dist->ifname ? dist->ifname : "", - VTY_NEWLINE); + dist->ifname ? dist->ifname : "", VTY_NEWLINE); write++; } @@ -729,10 +720,8 @@ config_write_distribute (struct vty *vty if (dist->list[DISTRIBUTE_OUT]) { vty_out (vty, " distribute-list %s out %s%s", - dist->list[DISTRIBUTE_OUT], - dist->ifname ? dist->ifname : "", - VTY_NEWLINE); + dist->ifname ? dist->ifname : "", VTY_NEWLINE); write++; } @@ -740,8 +729,7 @@ config_write_distribute (struct vty *vty { vty_out (vty, " distribute-list prefix %s in %s%s", dist->prefix[DISTRIBUTE_IN], - dist->ifname ? dist->ifname : "", - VTY_NEWLINE); + dist->ifname ? dist->ifname : "", VTY_NEWLINE); write++; } @@ -749,8 +737,7 @@ config_write_distribute (struct vty *vty { vty_out (vty, " distribute-list prefix %s out %s%s", dist->prefix[DISTRIBUTE_OUT], - dist->ifname ? dist->ifname : "", - VTY_NEWLINE); + dist->ifname ? dist->ifname : "", VTY_NEWLINE); write++; } } @@ -771,7 +758,8 @@ distribute_list_init (int node) disthash = hash_create ((unsigned int (*) (void *)) distribute_hash_make, (int (*) (void *, void *)) distribute_cmp); - if(node==RIP_NODE) { + if (node == RIP_NODE) + { install_element (RIP_NODE, &distribute_list_all_cmd); install_element (RIP_NODE, &no_distribute_list_all_cmd); install_element (RIP_NODE, &distribute_list_cmd); @@ -780,7 +768,9 @@ distribute_list_init (int node) install_element (RIP_NODE, &no_distribute_list_prefix_all_cmd); install_element (RIP_NODE, &distribute_list_prefix_cmd); install_element (RIP_NODE, &no_distribute_list_prefix_cmd); - } else { + } + else + { install_element (RIPNG_NODE, &ipv6_distribute_list_all_cmd); install_element (RIPNG_NODE, &no_ipv6_distribute_list_all_cmd); install_element (RIPNG_NODE, &ipv6_distribute_list_cmd); --- quagga-0.99.9/lib/distribute.h 2005-05-03 10:26:11.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/distribute.h 2008-04-16 11:55:47.000000000 -0700 @@ -51,7 +51,9 @@ extern struct distribute *distribute_loo extern int config_write_distribute (struct vty *); extern int config_show_distribute (struct vty *); -extern enum filter_type distribute_apply_in (struct interface *, struct prefix *); -extern enum filter_type distribute_apply_out (struct interface *, struct prefix *); +extern enum filter_type distribute_apply_in (struct interface *, + struct prefix *); +extern enum filter_type distribute_apply_out (struct interface *, + struct prefix *); #endif /* _ZEBRA_DISTRIBUTE_H */ --- quagga-0.99.9/lib/filter.c 2005-09-29 07:41:06.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/filter.c 2008-04-16 11:55:47.000000000 -0700 @@ -92,8 +92,7 @@ struct access_master }; /* Static structure for IPv4 access_list's master. */ -static struct access_master access_master_ipv4 = -{ +static struct access_master access_master_ipv4 = { {NULL, NULL}, {NULL, NULL}, NULL, @@ -102,8 +101,7 @@ static struct access_master access_maste #ifdef HAVE_IPV6 /* Static structure for IPv6 access_list's master. */ -static struct access_master access_master_ipv6 = -{ +static struct access_master access_master_ipv6 = { {NULL, NULL}, {NULL, NULL}, NULL, @@ -577,8 +575,7 @@ vty_access_list_remark_unset (struct vty access = access_list_lookup (afi, name); if (! access) { - vty_out (vty, "%% access-list %s doesn't exist%s", name, - VTY_NEWLINE); + vty_out (vty, "%% access-list %s doesn't exist%s", name, VTY_NEWLINE); return CMD_WARNING; } @@ -624,16 +621,14 @@ filter_set_cisco (struct vty *vty, const ret = inet_aton (addr_str, &addr); if (ret <= 0) { - vty_out (vty, "%%Inconsistent address and mask%s", - VTY_NEWLINE); + vty_out (vty, "%%Inconsistent address and mask%s", VTY_NEWLINE); return CMD_WARNING; } ret = inet_aton (addr_mask_str, &addr_mask); if (ret <= 0) { - vty_out (vty, "%%Inconsistent address and mask%s", - VTY_NEWLINE); + vty_out (vty, "%%Inconsistent address and mask%s", VTY_NEWLINE); return CMD_WARNING; } @@ -642,16 +637,14 @@ filter_set_cisco (struct vty *vty, const ret = inet_aton (mask_str, &mask); if (ret <= 0) { - vty_out (vty, "%%Inconsistent address and mask%s", - VTY_NEWLINE); + vty_out (vty, "%%Inconsistent address and mask%s", VTY_NEWLINE); return CMD_WARNING; } ret = inet_aton (mask_mask_str, &mask_mask); if (ret <= 0) { - vty_out (vty, "%%Inconsistent address and mask%s", - VTY_NEWLINE); + vty_out (vty, "%%Inconsistent address and mask%s", VTY_NEWLINE); return CMD_WARNING; } } @@ -702,9 +695,7 @@ DEFUN (access_list_standard, "IP standard access list\n" "IP standard access list (expanded range)\n" "Specify packets to reject\n" - "Specify packets to forward\n" - "Address to match\n" - "Wildcard bits\n") + "Specify packets to forward\n" "Address to match\n" "Wildcard bits\n") { return filter_set_cisco (vty, argv[0], argv[1], argv[2], argv[3], NULL, NULL, 0, 1); @@ -717,8 +708,7 @@ DEFUN (access_list_standard_nomask, "IP standard access list\n" "IP standard access list (expanded range)\n" "Specify packets to reject\n" - "Specify packets to forward\n" - "Address to match\n") + "Specify packets to forward\n" "Address to match\n") { return filter_set_cisco (vty, argv[0], argv[1], argv[2], "0.0.0.0", NULL, NULL, 0, 1); @@ -732,8 +722,7 @@ DEFUN (access_list_standard_host, "IP standard access list (expanded range)\n" "Specify packets to reject\n" "Specify packets to forward\n" - "A single host address\n" - "Address to match\n") + "A single host address\n" "Address to match\n") { return filter_set_cisco (vty, argv[0], argv[1], argv[2], "0.0.0.0", NULL, NULL, 0, 1); @@ -746,8 +735,7 @@ DEFUN (access_list_standard_any, "IP standard access list\n" "IP standard access list (expanded range)\n" "Specify packets to reject\n" - "Specify packets to forward\n" - "Any source host\n") + "Specify packets to forward\n" "Any source host\n") { return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", "255.255.255.255", NULL, NULL, 0, 1); @@ -761,9 +749,7 @@ DEFUN (no_access_list_standard, "IP standard access list\n" "IP standard access list (expanded range)\n" "Specify packets to reject\n" - "Specify packets to forward\n" - "Address to match\n" - "Wildcard bits\n") + "Specify packets to forward\n" "Address to match\n" "Wildcard bits\n") { return filter_set_cisco (vty, argv[0], argv[1], argv[2], argv[3], NULL, NULL, 0, 0); @@ -777,8 +763,7 @@ DEFUN (no_access_list_standard_nomask, "IP standard access list\n" "IP standard access list (expanded range)\n" "Specify packets to reject\n" - "Specify packets to forward\n" - "Address to match\n") + "Specify packets to forward\n" "Address to match\n") { return filter_set_cisco (vty, argv[0], argv[1], argv[2], "0.0.0.0", NULL, NULL, 0, 0); @@ -793,8 +778,7 @@ DEFUN (no_access_list_standard_host, "IP standard access list (expanded range)\n" "Specify packets to reject\n" "Specify packets to forward\n" - "A single host address\n" - "Address to match\n") + "A single host address\n" "Address to match\n") { return filter_set_cisco (vty, argv[0], argv[1], argv[2], "0.0.0.0", NULL, NULL, 0, 0); @@ -808,8 +792,7 @@ DEFUN (no_access_list_standard_any, "IP standard access list\n" "IP standard access list (expanded range)\n" "Specify packets to reject\n" - "Specify packets to forward\n" - "Any source host\n") + "Specify packets to forward\n" "Any source host\n") { return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", "255.255.255.255", NULL, NULL, 0, 0); @@ -827,8 +810,7 @@ DEFUN (access_list_extended, "Any Internet Protocol\n" "Source address\n" "Source wildcard bits\n" - "Destination address\n" - "Destination Wildcard bits\n") + "Destination address\n" "Destination Wildcard bits\n") { return filter_set_cisco (vty, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], 1 ,1); @@ -843,13 +825,10 @@ DEFUN (access_list_extended_mask_any, "Specify packets to reject\n" "Specify packets to forward\n" "Any Internet Protocol\n" - "Source address\n" - "Source wildcard bits\n" - "Any destination host\n") + "Source address\n" "Source wildcard bits\n" "Any destination host\n") { return filter_set_cisco (vty, argv[0], argv[1], argv[2], - argv[3], "0.0.0.0", - "255.255.255.255", 1, 1); + argv[3], "0.0.0.0", "255.255.255.255", 1, 1); } DEFUN (access_list_extended_any_mask, @@ -862,12 +841,10 @@ DEFUN (access_list_extended_any_mask, "Specify packets to forward\n" "Any Internet Protocol\n" "Any source host\n" - "Destination address\n" - "Destination Wildcard bits\n") + "Destination address\n" "Destination Wildcard bits\n") { return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", - "255.255.255.255", argv[2], - argv[3], 1, 1); + "255.255.255.255", argv[2], argv[3], 1, 1); } DEFUN (access_list_extended_any_any, @@ -878,9 +855,7 @@ DEFUN (access_list_extended_any_any, "IP extended access list (expanded range)\n" "Specify packets to reject\n" "Specify packets to forward\n" - "Any Internet Protocol\n" - "Any source host\n" - "Any destination host\n") + "Any Internet Protocol\n" "Any source host\n" "Any destination host\n") { return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", "255.255.255.255", "0.0.0.0", @@ -898,12 +873,10 @@ DEFUN (access_list_extended_mask_host, "Any Internet Protocol\n" "Source address\n" "Source wildcard bits\n" - "A single destination host\n" - "Destination address\n") + "A single destination host\n" "Destination address\n") { return filter_set_cisco (vty, argv[0], argv[1], argv[2], - argv[3], argv[4], - "0.0.0.0", 1, 1); + argv[3], argv[4], "0.0.0.0", 1, 1); } DEFUN (access_list_extended_host_mask, @@ -917,12 +890,10 @@ DEFUN (access_list_extended_host_mask, "Any Internet Protocol\n" "A single source host\n" "Source address\n" - "Destination address\n" - "Destination Wildcard bits\n") + "Destination address\n" "Destination Wildcard bits\n") { return filter_set_cisco (vty, argv[0], argv[1], argv[2], - "0.0.0.0", argv[3], - argv[4], 1, 1); + "0.0.0.0", argv[3], argv[4], 1, 1); } DEFUN (access_list_extended_host_host, @@ -936,12 +907,10 @@ DEFUN (access_list_extended_host_host, "Any Internet Protocol\n" "A single source host\n" "Source address\n" - "A single destination host\n" - "Destination address\n") + "A single destination host\n" "Destination address\n") { return filter_set_cisco (vty, argv[0], argv[1], argv[2], - "0.0.0.0", argv[3], - "0.0.0.0", 1, 1); + "0.0.0.0", argv[3], "0.0.0.0", 1, 1); } DEFUN (access_list_extended_any_host, @@ -954,12 +923,10 @@ DEFUN (access_list_extended_any_host, "Specify packets to forward\n" "Any Internet Protocol\n" "Any source host\n" - "A single destination host\n" - "Destination address\n") + "A single destination host\n" "Destination address\n") { return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", - "255.255.255.255", argv[2], - "0.0.0.0", 1, 1); + "255.255.255.255", argv[2], "0.0.0.0", 1, 1); } DEFUN (access_list_extended_host_any, @@ -971,13 +938,10 @@ DEFUN (access_list_extended_host_any, "Specify packets to reject\n" "Specify packets to forward\n" "Any Internet Protocol\n" - "A single source host\n" - "Source address\n" - "Any destination host\n") + "A single source host\n" "Source address\n" "Any destination host\n") { return filter_set_cisco (vty, argv[0], argv[1], argv[2], - "0.0.0.0", "0.0.0.0", - "255.255.255.255", 1, 1); + "0.0.0.0", "0.0.0.0", "255.255.255.255", 1, 1); } DEFUN (no_access_list_extended, @@ -992,8 +956,7 @@ DEFUN (no_access_list_extended, "Any Internet Protocol\n" "Source address\n" "Source wildcard bits\n" - "Destination address\n" - "Destination Wildcard bits\n") + "Destination address\n" "Destination Wildcard bits\n") { return filter_set_cisco (vty, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], 1, 0); @@ -1009,13 +972,10 @@ DEFUN (no_access_list_extended_mask_any, "Specify packets to reject\n" "Specify packets to forward\n" "Any Internet Protocol\n" - "Source address\n" - "Source wildcard bits\n" - "Any destination host\n") + "Source address\n" "Source wildcard bits\n" "Any destination host\n") { return filter_set_cisco (vty, argv[0], argv[1], argv[2], - argv[3], "0.0.0.0", - "255.255.255.255", 1, 0); + argv[3], "0.0.0.0", "255.255.255.255", 1, 0); } DEFUN (no_access_list_extended_any_mask, @@ -1029,12 +989,10 @@ DEFUN (no_access_list_extended_any_mask, "Specify packets to forward\n" "Any Internet Protocol\n" "Any source host\n" - "Destination address\n" - "Destination Wildcard bits\n") + "Destination address\n" "Destination Wildcard bits\n") { return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", - "255.255.255.255", argv[2], - argv[3], 1, 0); + "255.255.255.255", argv[2], argv[3], 1, 0); } DEFUN (no_access_list_extended_any_any, @@ -1046,9 +1004,7 @@ DEFUN (no_access_list_extended_any_any, "IP extended access list (expanded range)\n" "Specify packets to reject\n" "Specify packets to forward\n" - "Any Internet Protocol\n" - "Any source host\n" - "Any destination host\n") + "Any Internet Protocol\n" "Any source host\n" "Any destination host\n") { return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", "255.255.255.255", "0.0.0.0", @@ -1067,12 +1023,10 @@ DEFUN (no_access_list_extended_mask_host "Any Internet Protocol\n" "Source address\n" "Source wildcard bits\n" - "A single destination host\n" - "Destination address\n") + "A single destination host\n" "Destination address\n") { return filter_set_cisco (vty, argv[0], argv[1], argv[2], - argv[3], argv[4], - "0.0.0.0", 1, 0); + argv[3], argv[4], "0.0.0.0", 1, 0); } DEFUN (no_access_list_extended_host_mask, @@ -1087,12 +1041,10 @@ DEFUN (no_access_list_extended_host_mask "Any Internet Protocol\n" "A single source host\n" "Source address\n" - "Destination address\n" - "Destination Wildcard bits\n") + "Destination address\n" "Destination Wildcard bits\n") { return filter_set_cisco (vty, argv[0], argv[1], argv[2], - "0.0.0.0", argv[3], - argv[4], 1, 0); + "0.0.0.0", argv[3], argv[4], 1, 0); } DEFUN (no_access_list_extended_host_host, @@ -1107,12 +1059,10 @@ DEFUN (no_access_list_extended_host_host "Any Internet Protocol\n" "A single source host\n" "Source address\n" - "A single destination host\n" - "Destination address\n") + "A single destination host\n" "Destination address\n") { return filter_set_cisco (vty, argv[0], argv[1], argv[2], - "0.0.0.0", argv[3], - "0.0.0.0", 1, 0); + "0.0.0.0", argv[3], "0.0.0.0", 1, 0); } DEFUN (no_access_list_extended_any_host, @@ -1126,12 +1076,10 @@ DEFUN (no_access_list_extended_any_host, "Specify packets to forward\n" "Any Internet Protocol\n" "Any source host\n" - "A single destination host\n" - "Destination address\n") + "A single destination host\n" "Destination address\n") { return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", - "255.255.255.255", argv[2], - "0.0.0.0", 1, 0); + "255.255.255.255", argv[2], "0.0.0.0", 1, 0); } DEFUN (no_access_list_extended_host_any, @@ -1144,13 +1092,10 @@ DEFUN (no_access_list_extended_host_any, "Specify packets to reject\n" "Specify packets to forward\n" "Any Internet Protocol\n" - "A single source host\n" - "Source address\n" - "Any destination host\n") + "A single source host\n" "Source address\n" "Any destination host\n") { return filter_set_cisco (vty, argv[0], argv[1], argv[2], - "0.0.0.0", "0.0.0.0", - "255.255.255.255", 1, 0); + "0.0.0.0", "0.0.0.0", "255.255.255.255", 1, 0); } static int @@ -1241,8 +1186,7 @@ DEFUN (access_list, "Add an access list entry\n" "IP zebra access-list name\n" "Specify packets to reject\n" - "Specify packets to forward\n" - "Prefix to match. e.g. 10.0.0.0/8\n") + "Specify packets to forward\n" "Prefix to match. e.g. 10.0.0.0/8\n") { return filter_set_zebra (vty, argv[0], argv[1], AFI_IP, argv[2], 0, 1); } @@ -1254,8 +1198,7 @@ DEFUN (access_list_exact, "IP zebra access-list name\n" "Specify packets to reject\n" "Specify packets to forward\n" - "Prefix to match. e.g. 10.0.0.0/8\n" - "Exact match of the prefixes\n") + "Prefix to match. e.g. 10.0.0.0/8\n" "Exact match of the prefixes\n") { return filter_set_zebra (vty, argv[0], argv[1], AFI_IP, argv[2], 1, 1); } @@ -1266,8 +1209,7 @@ DEFUN (access_list_any, "Add an access list entry\n" "IP zebra access-list name\n" "Specify packets to reject\n" - "Specify packets to forward\n" - "Prefix to match. e.g. 10.0.0.0/8\n") + "Specify packets to forward\n" "Prefix to match. e.g. 10.0.0.0/8\n") { return filter_set_zebra (vty, argv[0], argv[1], AFI_IP, "0.0.0.0/0", 0, 1); } @@ -1279,8 +1221,7 @@ DEFUN (no_access_list, "Add an access list entry\n" "IP zebra access-list name\n" "Specify packets to reject\n" - "Specify packets to forward\n" - "Prefix to match. e.g. 10.0.0.0/8\n") + "Specify packets to forward\n" "Prefix to match. e.g. 10.0.0.0/8\n") { return filter_set_zebra (vty, argv[0], argv[1], AFI_IP, argv[2], 0, 0); } @@ -1293,8 +1234,7 @@ DEFUN (no_access_list_exact, "IP zebra access-list name\n" "Specify packets to reject\n" "Specify packets to forward\n" - "Prefix to match. e.g. 10.0.0.0/8\n" - "Exact match of the prefixes\n") + "Prefix to match. e.g. 10.0.0.0/8\n" "Exact match of the prefixes\n") { return filter_set_zebra (vty, argv[0], argv[1], AFI_IP, argv[2], 1, 0); } @@ -1306,8 +1246,7 @@ DEFUN (no_access_list_any, "Add an access list entry\n" "IP zebra access-list name\n" "Specify packets to reject\n" - "Specify packets to forward\n" - "Prefix to match. e.g. 10.0.0.0/8\n") + "Specify packets to forward\n" "Prefix to match. e.g. 10.0.0.0/8\n") { return filter_set_zebra (vty, argv[0], argv[1], AFI_IP, "0.0.0.0/0", 0, 0); } @@ -1356,8 +1295,7 @@ DEFUN (access_list_remark, "IP standard access list (expanded range)\n" "IP extended access list (expanded range)\n" "IP zebra access-list\n" - "Access list entry comment\n" - "Comment up to 100 characters\n") + "Access list entry comment\n" "Comment up to 100 characters\n") { struct access_list *access; @@ -1382,8 +1320,7 @@ DEFUN (no_access_list_remark, "IP extended access list\n" "IP standard access list (expanded range)\n" "IP extended access list (expanded range)\n" - "IP zebra access-list\n" - "Access list entry comment\n") + "IP zebra access-list\n" "Access list entry comment\n") { return vty_access_list_remark_unset (vty, AFI_IP, argv[0]); } @@ -1398,9 +1335,7 @@ ALIAS (no_access_list_remark, "IP standard access list (expanded range)\n" "IP extended access list (expanded range)\n" "IP zebra access-list\n" - "Access list entry comment\n" - "Comment up to 100 characters\n") - + "Access list entry comment\n" "Comment up to 100 characters\n") #ifdef HAVE_IPV6 DEFUN (ipv6_access_list, ipv6_access_list_cmd, @@ -1409,8 +1344,7 @@ DEFUN (ipv6_access_list, "Add an access list entry\n" "IPv6 zebra access-list\n" "Specify packets to reject\n" - "Specify packets to forward\n" - "Prefix to match. e.g. 3ffe:506::/32\n") + "Specify packets to forward\n" "Prefix to match. e.g. 3ffe:506::/32\n") { return filter_set_zebra (vty, argv[0], argv[1], AFI_IP6, argv[2], 0, 1); } @@ -1436,8 +1370,7 @@ DEFUN (ipv6_access_list_any, "Add an access list entry\n" "IPv6 zebra access-list\n" "Specify packets to reject\n" - "Specify packets to forward\n" - "Any prefixi to match\n") + "Specify packets to forward\n" "Any prefixi to match\n") { return filter_set_zebra (vty, argv[0], argv[1], AFI_IP6, "::/0", 0, 1); } @@ -1450,8 +1383,7 @@ DEFUN (no_ipv6_access_list, "Add an access list entry\n" "IPv6 zebra access-list\n" "Specify packets to reject\n" - "Specify packets to forward\n" - "Prefix to match. e.g. 3ffe:506::/32\n") + "Specify packets to forward\n" "Prefix to match. e.g. 3ffe:506::/32\n") { return filter_set_zebra (vty, argv[0], argv[1], AFI_IP6, argv[2], 0, 0); } @@ -1479,8 +1411,7 @@ DEFUN (no_ipv6_access_list_any, "Add an access list entry\n" "IPv6 zebra access-list\n" "Specify packets to reject\n" - "Specify packets to forward\n" - "Any prefixi to match\n") + "Specify packets to forward\n" "Any prefixi to match\n") { return filter_set_zebra (vty, argv[0], argv[1], AFI_IP6, "::/0", 0, 0); } @@ -1490,9 +1421,7 @@ DEFUN (no_ipv6_access_list_all, no_ipv6_access_list_all_cmd, "no ipv6 access-list WORD", NO_STR - IPV6_STR - "Add an access list entry\n" - "IPv6 zebra access-list\n") + IPV6_STR "Add an access list entry\n" "IPv6 zebra access-list\n") { struct access_list *access; struct access_master *master; @@ -1524,8 +1453,7 @@ DEFUN (ipv6_access_list_remark, IPV6_STR "Add an access list entry\n" "IPv6 zebra access-list\n" - "Access list entry comment\n" - "Comment up to 100 characters\n") + "Access list entry comment\n" "Comment up to 100 characters\n") { struct access_list *access; @@ -1547,8 +1475,7 @@ DEFUN (no_ipv6_access_list_remark, NO_STR IPV6_STR "Add an access list entry\n" - "IPv6 zebra access-list\n" - "Access list entry comment\n") + "IPv6 zebra access-list\n" "Access list entry comment\n") { return vty_access_list_remark_unset (vty, AFI_IP6, argv[0]); } @@ -1560,10 +1487,8 @@ ALIAS (no_ipv6_access_list_remark, IPV6_STR "Add an access list entry\n" "IPv6 zebra access-list\n" - "Access list entry comment\n" - "Comment up to 100 characters\n") + "Access list entry comment\n" "Comment up to 100 characters\n") #endif /* HAVE_IPV6 */ - void config_write_access_zebra (struct vty *, struct filter *); void config_write_access_cisco (struct vty *, struct filter *); @@ -1568,8 +1493,7 @@ void config_write_access_zebra (struct v void config_write_access_cisco (struct vty *, struct filter *); /* show access-list command. */ -static int -filter_show (struct vty *vty, const char *name, afi_t afi) + static int filter_show (struct vty *vty, const char *name, afi_t afi) { struct access_list *access; struct access_master *master; @@ -1602,8 +1526,7 @@ filter_show (struct vty *vty, const char vty_out (vty, "%s IP%s access list %s%s", mfilter->cisco ? (filter->extended ? "Extended" : "Standard") : "Zebra", - afi == AFI_IP6 ? "v6" : "", - access->name, VTY_NEWLINE); + afi == AFI_IP6 ? "v6" : "", access->name, VTY_NEWLINE); write = 0; } @@ -1622,7 +1545,8 @@ filter_show (struct vty *vty, const char { vty_out (vty, " %s", inet_ntoa (filter->addr)); if (filter->addr_mask.s_addr != 0) - vty_out (vty, ", wildcard bits %s", inet_ntoa (filter->addr_mask)); + vty_out (vty, ", wildcard bits %s", + inet_ntoa (filter->addr_mask)); vty_out (vty, "%s", VTY_NEWLINE); } } @@ -1645,8 +1569,7 @@ filter_show (struct vty *vty, const char vty_out (vty, "%s IP%s access list %s%s", mfilter->cisco ? (filter->extended ? "Extended" : "Standard") : "Zebra", - afi == AFI_IP6 ? "v6" : "", - access->name, VTY_NEWLINE); + afi == AFI_IP6 ? "v6" : "", access->name, VTY_NEWLINE); write = 0; } @@ -1665,7 +1588,8 @@ filter_show (struct vty *vty, const char { vty_out (vty, " %s", inet_ntoa (filter->addr)); if (filter->addr_mask.s_addr != 0) - vty_out (vty, ", wildcard bits %s", inet_ntoa (filter->addr_mask)); + vty_out (vty, ", wildcard bits %s", + inet_ntoa (filter->addr_mask)); vty_out (vty, "%s", VTY_NEWLINE); } } @@ -1676,10 +1600,7 @@ filter_show (struct vty *vty, const char DEFUN (show_ip_access_list, show_ip_access_list_cmd, - "show ip access-list", - SHOW_STR - IP_STR - "List IP access lists\n") + "show ip access-list", SHOW_STR IP_STR "List IP access lists\n") { return filter_show (vty, NULL, AFI_IP); } @@ -1693,8 +1614,7 @@ DEFUN (show_ip_access_list_name, "IP standard access list\n" "IP extended access list\n" "IP standard access list (expanded range)\n" - "IP extended access list (expanded range)\n" - "IP zebra access-list\n") + "IP extended access list (expanded range)\n" "IP zebra access-list\n") { return filter_show (vty, argv[0], AFI_IP); } @@ -1702,10 +1622,7 @@ DEFUN (show_ip_access_list_name, #ifdef HAVE_IPV6 DEFUN (show_ipv6_access_list, show_ipv6_access_list_cmd, - "show ipv6 access-list", - SHOW_STR - IPV6_STR - "List IPv6 access lists\n") + "show ipv6 access-list", SHOW_STR IPV6_STR "List IPv6 access lists\n") { return filter_show (vty, NULL, AFI_IP6); } @@ -1714,9 +1631,7 @@ DEFUN (show_ipv6_access_list_name, show_ipv6_access_list_name_cmd, "show ipv6 access-list WORD", SHOW_STR - IPV6_STR - "List IPv6 access lists\n" - "IPv6 zebra access-list\n") + IPV6_STR "List IPv6 access lists\n" "IPv6 zebra access-list\n") { return filter_show (vty, argv[0], AFI_IP6); } @@ -1782,8 +1697,7 @@ config_write_access_zebra (struct vty *v else vty_out (vty, " %s/%d%s", inet_ntop (p->family, &p->u.prefix, buf, BUFSIZ), - p->prefixlen, - filter->exact ? " exact-match" : ""); + p->prefixlen, filter->exact ? " exact-match" : ""); vty_out (vty, "%s", VTY_NEWLINE); } @@ -1806,8 +1720,7 @@ config_write_access (struct vty *vty, af { vty_out (vty, "%saccess-list %s remark %s%s", afi == AFI_IP ? "" : "ipv6 ", - access->name, access->remark, - VTY_NEWLINE); + access->name, access->remark, VTY_NEWLINE); write++; } @@ -1815,8 +1728,7 @@ config_write_access (struct vty *vty, af { vty_out (vty, "%saccess-list %s %s", afi == AFI_IP ? "" : "ipv6 ", - access->name, - filter_type_str (mfilter)); + access->name, filter_type_str (mfilter)); if (mfilter->cisco) config_write_access_cisco (vty, mfilter); @@ -1833,8 +1745,7 @@ config_write_access (struct vty *vty, af { vty_out (vty, "%saccess-list %s remark %s%s", afi == AFI_IP ? "" : "ipv6 ", - access->name, access->remark, - VTY_NEWLINE); + access->name, access->remark, VTY_NEWLINE); write++; } @@ -1842,8 +1753,7 @@ config_write_access (struct vty *vty, af { vty_out (vty, "%saccess-list %s %s", afi == AFI_IP ? "" : "ipv6 ", - access->name, - filter_type_str (mfilter)); + access->name, filter_type_str (mfilter)); if (mfilter->cisco) config_write_access_cisco (vty, mfilter); @@ -1857,8 +1767,7 @@ config_write_access (struct vty *vty, af } /* Access-list node. */ -struct cmd_node access_node = -{ +struct cmd_node access_node = { ACCESS_NODE, "", /* Access list has no interface. */ 1 @@ -1953,8 +1862,7 @@ access_list_init_ipv4 (void) } #ifdef HAVE_IPV6 -struct cmd_node access_ipv6_node = -{ +struct cmd_node access_ipv6_node = { ACCESS_IPV6_NODE, "", 1 --- quagga-0.99.9/lib/getopt1.c 2005-05-15 07:32:03.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/getopt1.c 2008-04-16 11:55:47.000000000 -0700 @@ -112,8 +112,7 @@ main (argc, argv) { int this_option_optind = optind ? optind : 1; int option_index = 0; - static struct option long_options[] = - { + static struct option long_options[] = { {"add", 1, 0, 0}, {"append", 0, 0, 0}, {"delete", 1, 0, 0}, --- quagga-0.99.9/lib/getopt.c 2005-08-13 03:55:48.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/getopt.c 2008-04-16 11:55:47.000000000 -0700 @@ -270,8 +270,7 @@ static char *const *original_argv; is valid for the getopt call we must make sure that the ARGV passed to getopt is that one passed to the process. */ static void -__attribute__ ((unused)) -store_args_and_env (int argc, char *const *argv) + __attribute__ ((unused)) store_args_and_env (int argc, char *const *argv) { /* XXX This is no good solution. We should rather copy the args so that we can compare them later. But we must not use malloc(3). */ @@ -638,7 +638,9 @@ _getopt_internal (argc, argv, optstring, if (longopts != NULL && (argv[optind][1] == '-' - || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) + || (long_only + && (argv[optind][2] + || !my_index (optstring, argv[optind][1]))))) { char *nameend; const struct option *p; @@ -704,12 +706,14 @@ _getopt_internal (argc, argv, optstring, if (argv[optind - 1][1] == '-') /* --option */ fprintf (stderr, - _("%s: option `--%s' doesn't allow an argument\n"), + _ + ("%s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name); else /* +option or -option */ fprintf (stderr, - _("%s: option `%c%s' doesn't allow an argument\n"), + _ + ("%s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[optind - 1][0], pfound->name); } @@ -786,11 +790,9 @@ _getopt_internal (argc, argv, optstring, { if (posixly_correct) /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: illegal option -- %c\n"), - argv[0], c); + fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c); else - fprintf (stderr, _("%s: invalid option -- %c\n"), - argv[0], c); + fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c); } optopt = c; return '?'; @@ -837,7 +839,8 @@ _getopt_internal (argc, argv, optstring, /* optarg is now the argument, see if it's in the table of longopts. */ - for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) + for (nextchar = nameend = optarg; *nameend && *nameend != '='; + nameend++) /* Do nothing. */ ; /* Test all long options for either exact match @@ -885,8 +888,7 @@ _getopt_internal (argc, argv, optstring, { if (opterr) fprintf (stderr, _("\ -%s: option `-W %s' doesn't allow an argument\n"), - argv[0], pfound->name); +%s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name); nextchar += strlen (nextchar); return '?'; @@ -978,9 +980,7 @@ getopt (argc, argv, optstring) const char *optstring; { return _getopt_internal (argc, argv, optstring, - (const struct option *) 0, - (int *) 0, - 0); + (const struct option *) 0, (int *) 0, 0); } #endif /* REALLY_NEED_PLAIN_GETOPT */ --- quagga-0.99.9/lib/getopt.h 2005-08-13 03:55:48.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/getopt.h 2008-04-16 11:55:47.000000000 -0700 @@ -35,7 +35,8 @@ */ #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif /* For communication from `getopt' to the caller. --- quagga-0.99.9/lib/if.c 2006-12-12 14:12:06.000000000 -0800 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/if.c 2008-04-16 11:55:47.000000000 -0700 @@ -36,6 +35,8 @@ #include "str.h" #include "log.h" + + /* Master list of interfaces. */ struct list *iflist; @@ -65,7 +66,8 @@ if_cmp_func (struct interface *ifp1, str p1 = ifp1->name; p2 = ifp2->name; - while (*p1 && *p2) { + while (*p1 && *p2) + { /* look up to any number */ l1 = strcspn(p1, "0123456789"); l2 = strcspn(p2, "0123456789"); @@ -164,7 +167,8 @@ if_delete (struct interface *ifp) void if_add_hook (int type, int (*func)(struct interface *ifp)) { - switch (type) { + switch (type) + { case IF_NEW_HOOK: if_master.if_new_hook = func; break; @@ -196,8 +200,7 @@ ifindex2ifname (unsigned int index) { struct interface *ifp; - return ((ifp = if_lookup_by_index(index)) != NULL) ? - ifp->name : "unknown"; + return ((ifp = if_lookup_by_index (index)) != NULL) ? ifp->name : "unknown"; } unsigned int @@ -266,6 +269,33 @@ if_lookup_exact_address (struct in_addr return NULL; } +/* Lookup interface by IPv6 address. */ +struct interface * +if_lookup_exact_address_ipv6 (struct in6_addr src) +{ + struct listnode *node; + struct listnode *cnode; + struct interface *ifp; + struct prefix *p; + struct connected *c; + + for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) + { + for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, c)) + { + p = c->address; + + if (p && p->family == AF_INET6) + { + if (IPV6_ADDR_SAME (&p->u.prefix6, &src)) + return ifp; + } + } + } + return NULL; +} + + /* Lookup interface by IPv4 address. */ struct interface * if_lookup_address (struct in_addr src) @@ -340,7 +370,8 @@ int if_is_operative (struct interface *ifp) { return ((ifp->flags & IFF_UP) && - (ifp->flags & IFF_RUNNING || !CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_LINKDETECTION))); + (ifp->flags & IFF_RUNNING + || !CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_LINKDETECTION))); } /* Is this loopback interface ? */ @@ -431,8 +462,7 @@ if_dump (struct interface *ifp) #ifdef HAVE_IPV6 "mtu6 %d " #endif /* HAVE_IPV6 */ - "%s", - ifp->name, ifp->ifindex, ifp->metric, ifp->mtu, + "%s", ifp->name, ifp->ifindex, ifp->metric, ifp->mtu, #ifdef HAVE_IPV6 ifp->mtu6, #endif /* HAVE_IPV6 */ @@ -474,9 +504,7 @@ DEFUN (interface_desc, DEFUN (no_interface_desc, no_interface_desc_cmd, - "no description", - NO_STR - "Interface specific description\n") + "no description", NO_STR "Interface specific description\n") { struct interface *ifp; @@ -533,8 +561,7 @@ if_sunwzebra_get (const char *name, size DEFUN (interface, interface_cmd, "interface IFNAME", - "Select an interface to configure\n" - "Interface's name\n") + "Select an interface to configure\n" "Interface's name\n") { struct interface *ifp; size_t sl; @@ -542,8 +569,7 @@ DEFUN (interface, if ((sl = strlen(argv[0])) > INTERFACE_NAMSIZ) { vty_out (vty, "%% Interface name %s is invalid: length exceeds " - "%d characters%s", - argv[0], INTERFACE_NAMSIZ, VTY_NEWLINE); + "%d characters%s", argv[0], INTERFACE_NAMSIZ, VTY_NEWLINE); return CMD_WARNING; } @@ -590,11 +616,7 @@ DEFUN_NOSH (no_interface, } /* For debug purpose. */ -DEFUN (show_address, - show_address_cmd, - "show address", - SHOW_STR - "address\n") +DEFUN (show_address, show_address_cmd, "show address", SHOW_STR "address\n") { struct listnode *node; struct listnode *node2; @@ -620,7 +642,8 @@ DEFUN (show_address, struct connected * connected_new (void) { - struct connected *new = XMALLOC (MTYPE_CONNECTED, sizeof (struct connected)); + struct connected *new = + XMALLOC (MTYPE_CONNECTED, sizeof (struct connected)); memset (new, 0, sizeof (struct connected)); return new; } @@ -655,8 +678,7 @@ connected_log (struct connected *connect snprintf (logbuf, BUFSIZ, "%s interface %s %s %s/%d ", str, ifp->name, prefix_family_str (p), - inet_ntop (p->family, &p->u.prefix, buf, BUFSIZ), - p->prefixlen); + inet_ntop (p->family, &p->u.prefix, buf, BUFSIZ), p->prefixlen); p = connected->destination; if (p) @@ -765,8 +787,11 @@ if_nametoindex (const char *name) { struct interface *ifp; - return ((ifp = if_lookup_by_name_len(name, strnlen(name, IFNAMSIZ))) != NULL) - ? ifp->ifindex : 0; + return ((ifp = + if_lookup_by_name_len (name, + strnlen (name, + IFNAMSIZ))) != + NULL) ? ifp->ifindex : 0; } #endif @@ -871,7 +896,8 @@ if_init (void) ifaddr_ipv4_table = route_table_init (); #endif /* ifaddr_ipv4_table */ - if (iflist) { + if (iflist) + { iflist->cmp = (int (*)(void *, void *))if_cmp_func; return; } --- quagga-0.99.9/lib/if.h 2007-05-09 13:59:34.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/if.h 2008-04-16 11:55:47.000000000 -0700 @@ -233,6 +235,7 @@ extern int if_cmp_func (struct interface extern struct interface *if_create (const char *name, int namelen); extern struct interface *if_lookup_by_index (unsigned int); extern struct interface *if_lookup_exact_address (struct in_addr); +extern struct interface *if_lookup_exact_address_ipv6 (struct in6_addr); extern struct interface *if_lookup_address (struct in_addr); /* These 2 functions are to be used when the ifname argument is terminated @@ -245,7 +248,8 @@ extern struct interface *if_get_by_name In most cases, strnlen should be used to calculate the namelen value. */ extern struct interface *if_lookup_by_name_len(const char *ifname, size_t namelen); -extern struct interface *if_get_by_name_len(const char *ifname, size_t namelen); +extern struct interface *if_get_by_name_len (const char *ifname, + size_t namelen); /* Delete the interface, but do not free the structure, and leave it in the --- quagga-0.99.9/lib/if_rmap.c 2005-10-25 22:05:45.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/if_rmap.c 2008-04-16 11:55:47.000000000 -0700 @@ -209,8 +209,7 @@ DEFUN (if_rmap, "Route map set\n" "Route map name\n" "Route map set for input filtering\n" - "Route map set for output filtering\n" - "Route map interface name\n") + "Route map set for output filtering\n" "Route map interface name\n") { enum if_rmap_type type; struct if_rmap *if_rmap; @@ -246,8 +244,7 @@ DEFUN (no_if_rmap, "Route map unset\n" "Route map name\n" "Route map for input filtering\n" - "Route map for output filtering\n" - "Route map interface name\n") + "Route map for output filtering\n" "Route map interface name\n") { int ret; enum if_rmap_type type; @@ -271,19 +268,15 @@ DEFUN (no_if_rmap, return CMD_SUCCESS; } -ALIAS (no_if_rmap, - no_if_ipv6_rmap_cmd, +ALIAS (no_if_rmap, no_if_ipv6_rmap_cmd, "no route-map ROUTEMAP_NAME (in|out) IFNAME", NO_STR "Route map unset\n" "Route map name\n" "Route map for input filtering\n" - "Route map for output filtering\n" - "Route map interface name\n") - + "Route map for output filtering\n" "Route map interface name\n") /* Configuration write function. */ -int -config_write_if_rmap (struct vty *vty) + int config_write_if_rmap (struct vty *vty) { unsigned int i; struct hash_backet *mp; @@ -300,8 +293,7 @@ config_write_if_rmap (struct vty *vty) { vty_out (vty, " route-map %s in %s%s", if_rmap->routemap[IF_RMAP_IN], - if_rmap->ifname, - VTY_NEWLINE); + if_rmap->ifname, VTY_NEWLINE); write++; } @@ -309,8 +301,7 @@ config_write_if_rmap (struct vty *vty) { vty_out (vty, " route-map %s out %s%s", if_rmap->routemap[IF_RMAP_OUT], - if_rmap->ifname, - VTY_NEWLINE); + if_rmap->ifname, VTY_NEWLINE); write++; } } @@ -327,10 +318,13 @@ void if_rmap_init (int node) { ifrmaphash = hash_create (if_rmap_hash_make, if_rmap_hash_cmp); - if (node == RIPNG_NODE) { + if (node == RIPNG_NODE) + { install_element (RIPNG_NODE, &if_ipv6_rmap_cmd); install_element (RIPNG_NODE, &no_if_ipv6_rmap_cmd); - } else if (node == RIP_NODE) { + } + else if (node == RIP_NODE) + { install_element (RIP_NODE, &if_rmap_cmd); install_element (RIP_NODE, &no_if_rmap_cmd); } --- quagga-0.99.9/lib/jhash.h 2005-05-03 12:06:44.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/jhash.h 2008-04-16 11:55:47.000000000 -0700 @@ -37,7 +37,8 @@ extern u_int32_t jhash2(u_int32_t *k, u_ * NOTE: In partilar the "c += length; __jhash_mix(a,b,c);" normally * done at the end is not done here. */ -extern u_int32_t jhash_3words(u_int32_t a, u_int32_t b, u_int32_t c, u_int32_t initval); +extern u_int32_t jhash_3words (u_int32_t a, u_int32_t b, u_int32_t c, + u_int32_t initval); extern u_int32_t jhash_2words(u_int32_t a, u_int32_t b, u_int32_t initval); extern u_int32_t jhash_1word(u_int32_t a, u_int32_t initval); --- quagga-0.99.9/lib/keychain.c 2005-05-03 11:13:23.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/keychain.c 2008-04-16 11:55:47.000000000 -0700 @@ -237,8 +237,7 @@ DEFUN (key_chain, key_chain_cmd, "key chain WORD", "Authentication key management\n" - "Key-chain management\n" - "Key-chain name\n") + "Key-chain management\n" "Key-chain name\n") { struct keychain *keychain; @@ -254,8 +253,7 @@ DEFUN (no_key_chain, "no key chain WORD", NO_STR "Authentication key management\n" - "Key-chain management\n" - "Key-chain name\n") + "Key-chain management\n" "Key-chain name\n") { struct keychain *keychain; @@ -274,9 +272,7 @@ DEFUN (no_key_chain, DEFUN (key, key_cmd, - "key <0-2147483647>", - "Configure a key\n" - "Key identifier number\n") + "key <0-2147483647>", "Configure a key\n" "Key identifier number\n") { struct keychain *keychain; struct key *key; @@ -295,9 +291,7 @@ DEFUN (key, DEFUN (no_key, no_key_cmd, "no key <0-2147483647>", - NO_STR - "Delete a key\n" - "Key identifier number\n") + NO_STR "Delete a key\n" "Key identifier number\n") { struct keychain *keychain; struct key *key; @@ -321,10 +315,7 @@ DEFUN (no_key, } DEFUN (key_string, - key_string_cmd, - "key-string LINE", - "Set key string\n" - "The key\n") + key_string_cmd, "key-string LINE", "Set key string\n" "The key\n") { struct key *key; @@ -339,10 +330,7 @@ DEFUN (key_string, DEFUN (no_key_string, no_key_string_cmd, - "no key-string [LINE]", - NO_STR - "Unset key string\n" - "The key\n") + "no key-string [LINE]", NO_STR "Unset key string\n" "The key\n") { struct key *key; @@ -360,8 +348,8 @@ DEFUN (no_key_string, /* Convert HH:MM:SS MON DAY YEAR to time_t value. -1 is returned when given string is malformed. */ static time_t -key_str2time (const char *time_str, const char *day_str, const char *month_str, - const char *year_str) +key_str2time (const char *time_str, const char *day_str, + const char *month_str, const char *year_str) { int i = 0; char *colon; @@ -370,8 +358,7 @@ key_str2time (const char *time_str, cons unsigned int sec, min, hour; unsigned int day, month, year; - const char *month_name[] = - { + const char *month_name[] = { "January", "February", "March", @@ -484,7 +471,8 @@ key_lifetime_set (struct vty *vty, struc if (time_end <= time_start) { - vty_out (vty, "Expire time is not later than start time%s", VTY_NEWLINE); + vty_out (vty, "Expire time is not later than start time%s", + VTY_NEWLINE); return CMD_WARNING; } @@ -548,8 +536,7 @@ DEFUN (accept_lifetime_day_month_day_mon "Year to start\n" "Time to expire\n" "Day of th month to expire\n" - "Month of the year to expire\n" - "Year to expire\n") + "Month of the year to expire\n" "Year to expire\n") { struct key *key; @@ -569,8 +556,7 @@ DEFUN (accept_lifetime_day_month_month_d "Year to start\n" "Time to expire\n" "Month of the year to expire\n" - "Day of th month to expire\n" - "Year to expire\n") + "Day of th month to expire\n" "Year to expire\n") { struct key *key; @@ -590,8 +576,7 @@ DEFUN (accept_lifetime_month_day_day_mon "Year to start\n" "Time to expire\n" "Day of th month to expire\n" - "Month of the year to expire\n" - "Year to expire\n") + "Month of the year to expire\n" "Year to expire\n") { struct key *key; @@ -611,8 +596,7 @@ DEFUN (accept_lifetime_month_day_month_d "Year to start\n" "Time to expire\n" "Month of the year to expire\n" - "Day of th month to expire\n" - "Year to expire\n") + "Day of th month to expire\n" "Year to expire\n") { struct key *key; @@ -628,9 +612,7 @@ DEFUN (accept_lifetime_infinite_day_mont "Set accept lifetime of the key\n" "Time to start\n" "Day of th month to start\n" - "Month of the year to start\n" - "Year to start\n" - "Never expires") + "Month of the year to start\n" "Year to start\n" "Never expires") { struct key *key; @@ -646,9 +628,7 @@ DEFUN (accept_lifetime_infinite_month_da "Set accept lifetime of the key\n" "Time to start\n" "Month of the year to start\n" - "Day of th month to start\n" - "Year to start\n" - "Never expires") + "Day of th month to start\n" "Year to start\n" "Never expires") { struct key *key; @@ -665,9 +645,7 @@ DEFUN (accept_lifetime_duration_day_mont "Time to start\n" "Day of th month to start\n" "Month of the year to start\n" - "Year to start\n" - "Duration of the key\n" - "Duration seconds\n") + "Year to start\n" "Duration of the key\n" "Duration seconds\n") { struct key *key; @@ -684,9 +662,7 @@ DEFUN (accept_lifetime_duration_month_da "Time to start\n" "Month of the year to start\n" "Day of th month to start\n" - "Year to start\n" - "Duration of the key\n" - "Duration seconds\n") + "Year to start\n" "Duration of the key\n" "Duration seconds\n") { struct key *key; @@ -706,15 +682,14 @@ DEFUN (send_lifetime_day_month_day_month "Year to start\n" "Time to expire\n" "Day of th month to expire\n" - "Month of the year to expire\n" - "Year to expire\n") + "Month of the year to expire\n" "Year to expire\n") { struct key *key; key = vty->index_sub; - return key_lifetime_set (vty, &key->send, argv[0], argv[1], argv[2], argv[3], - argv[4], argv[5], argv[6], argv[7]); + return key_lifetime_set (vty, &key->send, argv[0], argv[1], argv[2], + argv[3], argv[4], argv[5], argv[6], argv[7]); } DEFUN (send_lifetime_day_month_month_day, @@ -727,15 +702,14 @@ DEFUN (send_lifetime_day_month_month_day "Year to start\n" "Time to expire\n" "Month of the year to expire\n" - "Day of th month to expire\n" - "Year to expire\n") + "Day of th month to expire\n" "Year to expire\n") { struct key *key; key = vty->index_sub; - return key_lifetime_set (vty, &key->send, argv[0], argv[1], argv[2], argv[3], - argv[4], argv[6], argv[5], argv[7]); + return key_lifetime_set (vty, &key->send, argv[0], argv[1], argv[2], + argv[3], argv[4], argv[6], argv[5], argv[7]); } DEFUN (send_lifetime_month_day_day_month, @@ -748,15 +722,14 @@ DEFUN (send_lifetime_month_day_day_month "Year to start\n" "Time to expire\n" "Day of th month to expire\n" - "Month of the year to expire\n" - "Year to expire\n") + "Month of the year to expire\n" "Year to expire\n") { struct key *key; key = vty->index_sub; - return key_lifetime_set (vty, &key->send, argv[0], argv[2], argv[1], argv[3], - argv[4], argv[5], argv[6], argv[7]); + return key_lifetime_set (vty, &key->send, argv[0], argv[2], argv[1], + argv[3], argv[4], argv[5], argv[6], argv[7]); } DEFUN (send_lifetime_month_day_month_day, @@ -769,15 +742,14 @@ DEFUN (send_lifetime_month_day_month_day "Year to start\n" "Time to expire\n" "Month of the year to expire\n" - "Day of th month to expire\n" - "Year to expire\n") + "Day of th month to expire\n" "Year to expire\n") { struct key *key; key = vty->index_sub; - return key_lifetime_set (vty, &key->send, argv[0], argv[2], argv[1], argv[3], - argv[4], argv[6], argv[5], argv[7]); + return key_lifetime_set (vty, &key->send, argv[0], argv[2], argv[1], + argv[3], argv[4], argv[6], argv[5], argv[7]); } DEFUN (send_lifetime_infinite_day_month, @@ -786,16 +758,14 @@ DEFUN (send_lifetime_infinite_day_month, "Set send lifetime of the key\n" "Time to start\n" "Day of th month to start\n" - "Month of the year to start\n" - "Year to start\n" - "Never expires") + "Month of the year to start\n" "Year to start\n" "Never expires") { struct key *key; key = vty->index_sub; - return key_lifetime_infinite_set (vty, &key->send, argv[0], argv[1], argv[2], - argv[3]); + return key_lifetime_infinite_set (vty, &key->send, argv[0], argv[1], + argv[2], argv[3]); } DEFUN (send_lifetime_infinite_month_day, @@ -804,16 +774,14 @@ DEFUN (send_lifetime_infinite_month_day, "Set send lifetime of the key\n" "Time to start\n" "Month of the year to start\n" - "Day of th month to start\n" - "Year to start\n" - "Never expires") + "Day of th month to start\n" "Year to start\n" "Never expires") { struct key *key; key = vty->index_sub; - return key_lifetime_infinite_set (vty, &key->send, argv[0], argv[2], argv[1], - argv[3]); + return key_lifetime_infinite_set (vty, &key->send, argv[0], argv[2], + argv[1], argv[3]); } DEFUN (send_lifetime_duration_day_month, @@ -823,16 +791,14 @@ DEFUN (send_lifetime_duration_day_month, "Time to start\n" "Day of th month to start\n" "Month of the year to start\n" - "Year to start\n" - "Duration of the key\n" - "Duration seconds\n") + "Year to start\n" "Duration of the key\n" "Duration seconds\n") { struct key *key; key = vty->index_sub; - return key_lifetime_duration_set (vty, &key->send, argv[0], argv[1], argv[2], - argv[3], argv[4]); + return key_lifetime_duration_set (vty, &key->send, argv[0], argv[1], + argv[2], argv[3], argv[4]); } DEFUN (send_lifetime_duration_month_day, @@ -842,27 +808,23 @@ DEFUN (send_lifetime_duration_month_day, "Time to start\n" "Month of the year to start\n" "Day of th month to start\n" - "Year to start\n" - "Duration of the key\n" - "Duration seconds\n") + "Year to start\n" "Duration of the key\n" "Duration seconds\n") { struct key *key; key = vty->index_sub; - return key_lifetime_duration_set (vty, &key->send, argv[0], argv[2], argv[1], - argv[3], argv[4]); + return key_lifetime_duration_set (vty, &key->send, argv[0], argv[2], + argv[1], argv[3], argv[4]); } -struct cmd_node keychain_node = -{ +struct cmd_node keychain_node = { KEYCHAIN_NODE, "%s(config-keychain)# ", 1 }; -struct cmd_node keychain_key_node = -{ +struct cmd_node keychain_key_node = { KEYCHAIN_KEY_NODE, "%s(config-keychain-key)# ", 1 @@ -927,7 +889,8 @@ keychain_config_write (struct vty *vty) if (key->send.end == -1) vty_out (vty, " infinite"); else if (key->send.duration) - vty_out (vty, " duration %ld", (long)(key->send.end - key->send.start)); + vty_out (vty, " duration %ld", + (long) (key->send.end - key->send.start)); else { keychain_strftime (buf, BUFSIZ, &key->send.end); @@ -970,14 +933,22 @@ keychain_init () install_element (KEYCHAIN_KEY_NODE, &key_cmd); install_element (KEYCHAIN_KEY_NODE, &no_key_cmd); - install_element (KEYCHAIN_KEY_NODE, &accept_lifetime_day_month_day_month_cmd); - install_element (KEYCHAIN_KEY_NODE, &accept_lifetime_day_month_month_day_cmd); - install_element (KEYCHAIN_KEY_NODE, &accept_lifetime_month_day_day_month_cmd); - install_element (KEYCHAIN_KEY_NODE, &accept_lifetime_month_day_month_day_cmd); - install_element (KEYCHAIN_KEY_NODE, &accept_lifetime_infinite_day_month_cmd); - install_element (KEYCHAIN_KEY_NODE, &accept_lifetime_infinite_month_day_cmd); - install_element (KEYCHAIN_KEY_NODE, &accept_lifetime_duration_day_month_cmd); - install_element (KEYCHAIN_KEY_NODE, &accept_lifetime_duration_month_day_cmd); + install_element (KEYCHAIN_KEY_NODE, + &accept_lifetime_day_month_day_month_cmd); + install_element (KEYCHAIN_KEY_NODE, + &accept_lifetime_day_month_month_day_cmd); + install_element (KEYCHAIN_KEY_NODE, + &accept_lifetime_month_day_day_month_cmd); + install_element (KEYCHAIN_KEY_NODE, + &accept_lifetime_month_day_month_day_cmd); + install_element (KEYCHAIN_KEY_NODE, + &accept_lifetime_infinite_day_month_cmd); + install_element (KEYCHAIN_KEY_NODE, + &accept_lifetime_infinite_month_day_cmd); + install_element (KEYCHAIN_KEY_NODE, + &accept_lifetime_duration_day_month_cmd); + install_element (KEYCHAIN_KEY_NODE, + &accept_lifetime_duration_month_day_cmd); install_element (KEYCHAIN_KEY_NODE, &send_lifetime_day_month_day_month_cmd); install_element (KEYCHAIN_KEY_NODE, &send_lifetime_day_month_month_day_cmd); --- quagga-0.99.9/lib/keychain.h 2005-05-03 10:51:36.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/keychain.h 2008-04-16 11:55:47.000000000 -0700 @@ -50,7 +50,8 @@ struct key extern void keychain_init (void); extern struct keychain *keychain_lookup (const char *); extern struct key *key_lookup_for_accept (const struct keychain *, u_int32_t); -extern struct key *key_match_for_accept (const struct keychain *, const char *); +extern struct key *key_match_for_accept (const struct keychain *, + const char *); extern struct key *key_lookup_for_send (const struct keychain *); #endif /* _ZEBRA_KEYCHAIN_H */ --- quagga-0.99.9/lib/linklist.h 2005-05-03 12:07:24.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/linklist.h 2008-04-16 11:55:47.000000000 -0700 @@ -100,9 +101,9 @@ extern void list_add_list (struct list * * of previous macro. */ #define ALL_LIST_ELEMENTS_RO(list,node,data) \ - (node) = listhead(list); \ - (node) != NULL && ((data) = listgetdata(node), 1); \ - (node) = listnextnode(node) + (node) = (typeof(node))listhead(list); \ + (node) != NULL && ((data) = (typeof(data))listgetdata(node), 1); \ + (node) = (typeof(node))listnextnode(node) /* these *do not* cleanup list nodes and referenced data, as the functions * do - these macros simply {de,at}tach a listnode from/to a list. --- quagga-0.99.9/lib/log.h 2007-04-29 05:40:40.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/log.h 2008-04-16 11:55:47.000000000 -0700 @@ -111,13 +111,16 @@ extern void closezlog (struct zlog *zl); #endif /* __GNUC__ */ /* Generic function for zlog. */ -extern void zlog (struct zlog *zl, int priority, const char *format, ...) PRINTF_ATTRIBUTE(3, 4); +extern void +zlog (struct zlog *zl, int priority, const char *format, ...) +PRINTF_ATTRIBUTE (3, 4); /* Handy zlog functions. */ extern void zlog_err (const char *format, ...) PRINTF_ATTRIBUTE(1, 2); extern void zlog_warn (const char *format, ...) PRINTF_ATTRIBUTE(1, 2); extern void zlog_info (const char *format, ...) PRINTF_ATTRIBUTE(1, 2); -extern void zlog_notice (const char *format, ...) PRINTF_ATTRIBUTE(1, 2); + extern void zlog_notice (const char *format, ...) PRINTF_ATTRIBUTE (1, + 2); extern void zlog_debug (const char *format, ...) PRINTF_ATTRIBUTE(1, 2); /* For bgpd's peer oriented log. */ @@ -134,7 +137,8 @@ extern void plog_debug (struct zlog *, c extern void zlog_set_level (struct zlog *zl, zlog_dest_t, int log_level); /* Set logging to the given filename at the specified level. */ -extern int zlog_set_file (struct zlog *zl, const char *filename, int log_level); + extern int zlog_set_file (struct zlog *zl, const char *filename, + int log_level); /* Disable file logging. */ extern int zlog_reset_file (struct zlog *zl); @@ -145,7 +149,8 @@ extern int zlog_rotate (struct zlog *); #define LOOKUP(x, y) mes_lookup(x, x ## _max, y) extern const char *lookup (struct message *, int); -extern const char *mes_lookup (struct message *meslist, int max, int index); + extern const char *mes_lookup (struct message *meslist, int max, + int index); extern const char *zlog_priority[]; extern const char *zlog_proto_names[]; @@ -175,11 +180,13 @@ extern void zlog_backtrace_sigsafe(int p It caches the most recent localtime result and can therefore avoid multiple calls within the same second. If buflen is too small, *buf will be set to '\0', and 0 will be returned. */ -extern size_t quagga_timestamp(int timestamp_precision /* # subsecond digits */, + extern size_t quagga_timestamp (int timestamp_precision + /* # subsecond digits */ , char *buf, size_t buflen); /* structure useful for avoiding repeated rendering of the same timestamp */ -struct timestamp_control { + struct timestamp_control + { size_t len; /* length of rendered timestamp */ int precision; /* configuration parameter */ int already_rendered; /* should be initialized to 0 */ --- quagga-0.99.9/lib/md5.c 2006-01-31 12:55:52.000000000 -0800 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/md5.c 2008-04-16 11:55:47.000000000 -0700 @@ -135,7 +135,8 @@ static const uint8_t md5_paddat[MD5_BUFL static void md5_calc (const uint8_t *, md5_ctxt *); -void md5_init(md5_ctxt *ctxt) +void +md5_init (md5_ctxt * ctxt) { ctxt->md5_n = 0; ctxt->md5_i = 0; @@ -146,7 +147,8 @@ void md5_init(md5_ctxt *ctxt) memset (ctxt->md5_buf, 0, sizeof(ctxt->md5_buf)); } -void md5_loop(md5_ctxt *ctxt, const void *vinput, uint len) +void +md5_loop (md5_ctxt * ctxt, const void *vinput, uint len) { uint gap, i; const uint8_t *input = vinput; @@ -154,32 +156,40 @@ void md5_loop(md5_ctxt *ctxt, const void ctxt->md5_n += len * 8; /* byte to bit */ gap = MD5_BUFLEN - ctxt->md5_i; - if (len >= gap) { + if (len >= gap) + { memcpy (ctxt->md5_buf + ctxt->md5_i, input, gap); md5_calc(ctxt->md5_buf, ctxt); - for (i = gap; i + MD5_BUFLEN <= len; i += MD5_BUFLEN) { + for (i = gap; i + MD5_BUFLEN <= len; i += MD5_BUFLEN) + { md5_calc((input + i), ctxt); } ctxt->md5_i = len - i; memcpy (ctxt->md5_buf, (input + i), ctxt->md5_i); - } else { + } + else + { memcpy (ctxt->md5_buf + ctxt->md5_i, input, len); ctxt->md5_i += len; } } -void md5_pad(md5_ctxt *ctxt) +void +md5_pad (md5_ctxt * ctxt) { uint gap; /* Don't count up padding. Keep md5_n. */ gap = MD5_BUFLEN - ctxt->md5_i; - if (gap > 8) { + if (gap > 8) + { memcpy (ctxt->md5_buf + ctxt->md5_i, md5_paddat, gap - sizeof(ctxt->md5_n)); - } else { + } + else + { /* including gap == 8 */ memcpy (ctxt->md5_buf + ctxt->md5_i, md5_paddat, gap); md5_calc (ctxt->md5_buf, ctxt); @@ -204,25 +214,35 @@ void md5_pad(md5_ctxt *ctxt) md5_calc(ctxt->md5_buf, ctxt); } -void md5_result(uint8_t *digest, md5_ctxt *ctxt) +void +md5_result (uint8_t * digest, md5_ctxt * ctxt) { /* 4 byte words */ if (BYTE_ORDER == LITTLE_ENDIAN) memcpy (digest, &ctxt->md5_st8[0], 16); else if (BYTE_ORDER == BIG_ENDIAN) { - digest[ 0] = ctxt->md5_st8[ 3]; digest[ 1] = ctxt->md5_st8[ 2]; - digest[ 2] = ctxt->md5_st8[ 1]; digest[ 3] = ctxt->md5_st8[ 0]; - digest[ 4] = ctxt->md5_st8[ 7]; digest[ 5] = ctxt->md5_st8[ 6]; - digest[ 6] = ctxt->md5_st8[ 5]; digest[ 7] = ctxt->md5_st8[ 4]; - digest[ 8] = ctxt->md5_st8[11]; digest[ 9] = ctxt->md5_st8[10]; - digest[10] = ctxt->md5_st8[ 9]; digest[11] = ctxt->md5_st8[ 8]; - digest[12] = ctxt->md5_st8[15]; digest[13] = ctxt->md5_st8[14]; - digest[14] = ctxt->md5_st8[13]; digest[15] = ctxt->md5_st8[12]; + digest[0] = ctxt->md5_st8[3]; + digest[1] = ctxt->md5_st8[2]; + digest[2] = ctxt->md5_st8[1]; + digest[3] = ctxt->md5_st8[0]; + digest[4] = ctxt->md5_st8[7]; + digest[5] = ctxt->md5_st8[6]; + digest[6] = ctxt->md5_st8[5]; + digest[7] = ctxt->md5_st8[4]; + digest[8] = ctxt->md5_st8[11]; + digest[9] = ctxt->md5_st8[10]; + digest[10] = ctxt->md5_st8[9]; + digest[11] = ctxt->md5_st8[8]; + digest[12] = ctxt->md5_st8[15]; + digest[13] = ctxt->md5_st8[14]; + digest[14] = ctxt->md5_st8[13]; + digest[15] = ctxt->md5_st8[12]; } } -static void md5_calc(const uint8_t *b64, md5_ctxt * ctxt) +static void +md5_calc (const uint8_t * b64, md5_ctxt * ctxt) { uint32_t A = ctxt->md5_sta; uint32_t B = ctxt->md5_stb; @@ -238,59 +258,139 @@ static void md5_calc(const uint8_t *b64, /* 4 byte words */ /* what a brute force but fast! */ uint8_t *y = (uint8_t *)X; - y[ 0] = b64[ 3]; y[ 1] = b64[ 2]; y[ 2] = b64[ 1]; y[ 3] = b64[ 0]; - y[ 4] = b64[ 7]; y[ 5] = b64[ 6]; y[ 6] = b64[ 5]; y[ 7] = b64[ 4]; - y[ 8] = b64[11]; y[ 9] = b64[10]; y[10] = b64[ 9]; y[11] = b64[ 8]; - y[12] = b64[15]; y[13] = b64[14]; y[14] = b64[13]; y[15] = b64[12]; - y[16] = b64[19]; y[17] = b64[18]; y[18] = b64[17]; y[19] = b64[16]; - y[20] = b64[23]; y[21] = b64[22]; y[22] = b64[21]; y[23] = b64[20]; - y[24] = b64[27]; y[25] = b64[26]; y[26] = b64[25]; y[27] = b64[24]; - y[28] = b64[31]; y[29] = b64[30]; y[30] = b64[29]; y[31] = b64[28]; - y[32] = b64[35]; y[33] = b64[34]; y[34] = b64[33]; y[35] = b64[32]; - y[36] = b64[39]; y[37] = b64[38]; y[38] = b64[37]; y[39] = b64[36]; - y[40] = b64[43]; y[41] = b64[42]; y[42] = b64[41]; y[43] = b64[40]; - y[44] = b64[47]; y[45] = b64[46]; y[46] = b64[45]; y[47] = b64[44]; - y[48] = b64[51]; y[49] = b64[50]; y[50] = b64[49]; y[51] = b64[48]; - y[52] = b64[55]; y[53] = b64[54]; y[54] = b64[53]; y[55] = b64[52]; - y[56] = b64[59]; y[57] = b64[58]; y[58] = b64[57]; y[59] = b64[56]; - y[60] = b64[63]; y[61] = b64[62]; y[62] = b64[61]; y[63] = b64[60]; - } - - ROUND1(A, B, C, D, 0, Sa, 1); ROUND1(D, A, B, C, 1, Sb, 2); - ROUND1(C, D, A, B, 2, Sc, 3); ROUND1(B, C, D, A, 3, Sd, 4); - ROUND1(A, B, C, D, 4, Sa, 5); ROUND1(D, A, B, C, 5, Sb, 6); - ROUND1(C, D, A, B, 6, Sc, 7); ROUND1(B, C, D, A, 7, Sd, 8); - ROUND1(A, B, C, D, 8, Sa, 9); ROUND1(D, A, B, C, 9, Sb, 10); - ROUND1(C, D, A, B, 10, Sc, 11); ROUND1(B, C, D, A, 11, Sd, 12); - ROUND1(A, B, C, D, 12, Sa, 13); ROUND1(D, A, B, C, 13, Sb, 14); - ROUND1(C, D, A, B, 14, Sc, 15); ROUND1(B, C, D, A, 15, Sd, 16); - - ROUND2(A, B, C, D, 1, Se, 17); ROUND2(D, A, B, C, 6, Sf, 18); - ROUND2(C, D, A, B, 11, Sg, 19); ROUND2(B, C, D, A, 0, Sh, 20); - ROUND2(A, B, C, D, 5, Se, 21); ROUND2(D, A, B, C, 10, Sf, 22); - ROUND2(C, D, A, B, 15, Sg, 23); ROUND2(B, C, D, A, 4, Sh, 24); - ROUND2(A, B, C, D, 9, Se, 25); ROUND2(D, A, B, C, 14, Sf, 26); - ROUND2(C, D, A, B, 3, Sg, 27); ROUND2(B, C, D, A, 8, Sh, 28); - ROUND2(A, B, C, D, 13, Se, 29); ROUND2(D, A, B, C, 2, Sf, 30); - ROUND2(C, D, A, B, 7, Sg, 31); ROUND2(B, C, D, A, 12, Sh, 32); - - ROUND3(A, B, C, D, 5, Si, 33); ROUND3(D, A, B, C, 8, Sj, 34); - ROUND3(C, D, A, B, 11, Sk, 35); ROUND3(B, C, D, A, 14, Sl, 36); - ROUND3(A, B, C, D, 1, Si, 37); ROUND3(D, A, B, C, 4, Sj, 38); - ROUND3(C, D, A, B, 7, Sk, 39); ROUND3(B, C, D, A, 10, Sl, 40); - ROUND3(A, B, C, D, 13, Si, 41); ROUND3(D, A, B, C, 0, Sj, 42); - ROUND3(C, D, A, B, 3, Sk, 43); ROUND3(B, C, D, A, 6, Sl, 44); - ROUND3(A, B, C, D, 9, Si, 45); ROUND3(D, A, B, C, 12, Sj, 46); - ROUND3(C, D, A, B, 15, Sk, 47); ROUND3(B, C, D, A, 2, Sl, 48); - - ROUND4(A, B, C, D, 0, Sm, 49); ROUND4(D, A, B, C, 7, Sn, 50); - ROUND4(C, D, A, B, 14, So, 51); ROUND4(B, C, D, A, 5, Sp, 52); - ROUND4(A, B, C, D, 12, Sm, 53); ROUND4(D, A, B, C, 3, Sn, 54); - ROUND4(C, D, A, B, 10, So, 55); ROUND4(B, C, D, A, 1, Sp, 56); - ROUND4(A, B, C, D, 8, Sm, 57); ROUND4(D, A, B, C, 15, Sn, 58); - ROUND4(C, D, A, B, 6, So, 59); ROUND4(B, C, D, A, 13, Sp, 60); - ROUND4(A, B, C, D, 4, Sm, 61); ROUND4(D, A, B, C, 11, Sn, 62); - ROUND4(C, D, A, B, 2, So, 63); ROUND4(B, C, D, A, 9, Sp, 64); + y[0] = b64[3]; + y[1] = b64[2]; + y[2] = b64[1]; + y[3] = b64[0]; + y[4] = b64[7]; + y[5] = b64[6]; + y[6] = b64[5]; + y[7] = b64[4]; + y[8] = b64[11]; + y[9] = b64[10]; + y[10] = b64[9]; + y[11] = b64[8]; + y[12] = b64[15]; + y[13] = b64[14]; + y[14] = b64[13]; + y[15] = b64[12]; + y[16] = b64[19]; + y[17] = b64[18]; + y[18] = b64[17]; + y[19] = b64[16]; + y[20] = b64[23]; + y[21] = b64[22]; + y[22] = b64[21]; + y[23] = b64[20]; + y[24] = b64[27]; + y[25] = b64[26]; + y[26] = b64[25]; + y[27] = b64[24]; + y[28] = b64[31]; + y[29] = b64[30]; + y[30] = b64[29]; + y[31] = b64[28]; + y[32] = b64[35]; + y[33] = b64[34]; + y[34] = b64[33]; + y[35] = b64[32]; + y[36] = b64[39]; + y[37] = b64[38]; + y[38] = b64[37]; + y[39] = b64[36]; + y[40] = b64[43]; + y[41] = b64[42]; + y[42] = b64[41]; + y[43] = b64[40]; + y[44] = b64[47]; + y[45] = b64[46]; + y[46] = b64[45]; + y[47] = b64[44]; + y[48] = b64[51]; + y[49] = b64[50]; + y[50] = b64[49]; + y[51] = b64[48]; + y[52] = b64[55]; + y[53] = b64[54]; + y[54] = b64[53]; + y[55] = b64[52]; + y[56] = b64[59]; + y[57] = b64[58]; + y[58] = b64[57]; + y[59] = b64[56]; + y[60] = b64[63]; + y[61] = b64[62]; + y[62] = b64[61]; + y[63] = b64[60]; + } + + ROUND1 (A, B, C, D, 0, Sa, 1); + ROUND1 (D, A, B, C, 1, Sb, 2); + ROUND1 (C, D, A, B, 2, Sc, 3); + ROUND1 (B, C, D, A, 3, Sd, 4); + ROUND1 (A, B, C, D, 4, Sa, 5); + ROUND1 (D, A, B, C, 5, Sb, 6); + ROUND1 (C, D, A, B, 6, Sc, 7); + ROUND1 (B, C, D, A, 7, Sd, 8); + ROUND1 (A, B, C, D, 8, Sa, 9); + ROUND1 (D, A, B, C, 9, Sb, 10); + ROUND1 (C, D, A, B, 10, Sc, 11); + ROUND1 (B, C, D, A, 11, Sd, 12); + ROUND1 (A, B, C, D, 12, Sa, 13); + ROUND1 (D, A, B, C, 13, Sb, 14); + ROUND1 (C, D, A, B, 14, Sc, 15); + ROUND1 (B, C, D, A, 15, Sd, 16); + + ROUND2 (A, B, C, D, 1, Se, 17); + ROUND2 (D, A, B, C, 6, Sf, 18); + ROUND2 (C, D, A, B, 11, Sg, 19); + ROUND2 (B, C, D, A, 0, Sh, 20); + ROUND2 (A, B, C, D, 5, Se, 21); + ROUND2 (D, A, B, C, 10, Sf, 22); + ROUND2 (C, D, A, B, 15, Sg, 23); + ROUND2 (B, C, D, A, 4, Sh, 24); + ROUND2 (A, B, C, D, 9, Se, 25); + ROUND2 (D, A, B, C, 14, Sf, 26); + ROUND2 (C, D, A, B, 3, Sg, 27); + ROUND2 (B, C, D, A, 8, Sh, 28); + ROUND2 (A, B, C, D, 13, Se, 29); + ROUND2 (D, A, B, C, 2, Sf, 30); + ROUND2 (C, D, A, B, 7, Sg, 31); + ROUND2 (B, C, D, A, 12, Sh, 32); + + ROUND3 (A, B, C, D, 5, Si, 33); + ROUND3 (D, A, B, C, 8, Sj, 34); + ROUND3 (C, D, A, B, 11, Sk, 35); + ROUND3 (B, C, D, A, 14, Sl, 36); + ROUND3 (A, B, C, D, 1, Si, 37); + ROUND3 (D, A, B, C, 4, Sj, 38); + ROUND3 (C, D, A, B, 7, Sk, 39); + ROUND3 (B, C, D, A, 10, Sl, 40); + ROUND3 (A, B, C, D, 13, Si, 41); + ROUND3 (D, A, B, C, 0, Sj, 42); + ROUND3 (C, D, A, B, 3, Sk, 43); + ROUND3 (B, C, D, A, 6, Sl, 44); + ROUND3 (A, B, C, D, 9, Si, 45); + ROUND3 (D, A, B, C, 12, Sj, 46); + ROUND3 (C, D, A, B, 15, Sk, 47); + ROUND3 (B, C, D, A, 2, Sl, 48); + + ROUND4 (A, B, C, D, 0, Sm, 49); + ROUND4 (D, A, B, C, 7, Sn, 50); + ROUND4 (C, D, A, B, 14, So, 51); + ROUND4 (B, C, D, A, 5, Sp, 52); + ROUND4 (A, B, C, D, 12, Sm, 53); + ROUND4 (D, A, B, C, 3, Sn, 54); + ROUND4 (C, D, A, B, 10, So, 55); + ROUND4 (B, C, D, A, 1, Sp, 56); + ROUND4 (A, B, C, D, 8, Sm, 57); + ROUND4 (D, A, B, C, 15, Sn, 58); + ROUND4 (C, D, A, B, 6, So, 59); + ROUND4 (B, C, D, A, 13, Sp, 60); + ROUND4 (A, B, C, D, 4, Sm, 61); + ROUND4 (D, A, B, C, 11, Sn, 62); + ROUND4 (C, D, A, B, 2, So, 63); + ROUND4 (B, C, D, A, 9, Sp, 64); ctxt->md5_sta += A; ctxt->md5_stb += B; --- quagga-0.99.9/lib/md5.h 2006-01-31 12:55:52.000000000 -0800 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/md5.h 2008-04-16 11:55:47.000000000 -0700 @@ -44,8 +44,10 @@ #define MD5_BUFLEN 64 -typedef struct { - union { +typedef struct +{ + union + { uint32_t md5_state32[4]; uint8_t md5_state8[16]; } md5_st; @@ -56,7 +58,8 @@ typedef struct { #define md5_std md5_st.md5_state32[3] #define md5_st8 md5_st.md5_state8 - union { + union + { uint64_t md5_count64; uint8_t md5_count8[8]; } md5_count; --- quagga-0.99.9/lib/memory.c 2007-03-20 11:23:00.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/memory.c 2008-04-16 11:55:47.000000000 -0700 @@ -33,8 +33,7 @@ static void alloc_inc (int); static void alloc_dec (int); static void log_memstats(int log_priority); -static struct message mstr [] = -{ +static struct message mstr[] = { { MTYPE_THREAD, "thread" }, { MTYPE_THREAD_MASTER, "thread_master" }, { MTYPE_VECTOR, "vector" }, @@ -140,7 +139,8 @@ static struct static void mtype_log (char *func, void *memory, const char *file, int line, int type) { - zlog_debug ("%s: %s %p %s %d", func, lookup (mstr, type), memory, file, line); + zlog_debug ("%s: %s %p %s %d", func, lookup (mstr, type), memory, file, + line); } void * @@ -249,7 +249,8 @@ log_memstats(int pri) zlog (NULL, pri, "Memory utilization in module %s:", ml->name); for (m = ml->list; m->index >= 0; m++) if (m->index && mstat[m->index].alloc) - zlog (NULL, pri, " %-30s: %10ld", m->format, mstat[m->index].alloc); + zlog (NULL, pri, " %-30s: %10ld", m->format, + mstat[m->index].alloc); } } @@ -291,32 +292,23 @@ show_memory_mallinfo (struct vty *vty) vty_out (vty, "System allocator statistics:%s", VTY_NEWLINE); vty_out (vty, " Total heap allocated: %s%s", - mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.arena), - VTY_NEWLINE); + mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.arena), VTY_NEWLINE); vty_out (vty, " Holding block headers: %s%s", - mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.hblkhd), - VTY_NEWLINE); + mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.hblkhd), VTY_NEWLINE); vty_out (vty, " Used small blocks: %s%s", - mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.usmblks), - VTY_NEWLINE); + mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.usmblks), VTY_NEWLINE); vty_out (vty, " Used ordinary blocks: %s%s", - mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.uordblks), - VTY_NEWLINE); + mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.uordblks), VTY_NEWLINE); vty_out (vty, " Free small blocks: %s%s", - mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.fsmblks), - VTY_NEWLINE); + mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.fsmblks), VTY_NEWLINE); vty_out (vty, " Free ordinary blocks: %s%s", - mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.fordblks), - VTY_NEWLINE); + mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.fordblks), VTY_NEWLINE); vty_out (vty, " Ordinary blocks: %ld%s", - (unsigned long)minfo.ordblks, - VTY_NEWLINE); + (unsigned long) minfo.ordblks, VTY_NEWLINE); vty_out (vty, " Small blocks: %ld%s", - (unsigned long)minfo.smblks, - VTY_NEWLINE); + (unsigned long) minfo.smblks, VTY_NEWLINE); vty_out (vty, " Holding blocks: %ld%s", - (unsigned long)minfo.hblks, - VTY_NEWLINE); + (unsigned long) minfo.hblks, VTY_NEWLINE); vty_out (vty, "(see system documentation for 'mallinfo' for meaning)%s", VTY_NEWLINE); return 1; @@ -327,8 +319,7 @@ DEFUN (show_memory_all, show_memory_all_cmd, "show memory all", "Show running system information\n" - "Memory statistics\n" - "All memory statistics\n") + "Memory statistics\n" "All memory statistics\n") { struct mlist *ml; int needsep = 0; @@ -352,13 +343,9 @@ ALIAS (show_memory_all, "show memory", "Show running system information\n" "Memory statistics\n") - DEFUN (show_memory_lib, show_memory_lib_cmd, - "show memory lib", - SHOW_STR - "Memory statistics\n" - "Library memory\n") + "show memory lib", SHOW_STR "Memory statistics\n" "Library memory\n") { show_memory_vty (vty, memory_list_lib); return CMD_SUCCESS; @@ -366,10 +353,7 @@ DEFUN (show_memory_lib, DEFUN (show_memory_zebra, show_memory_zebra_cmd, - "show memory zebra", - SHOW_STR - "Memory statistics\n" - "Zebra memory\n") + "show memory zebra", SHOW_STR "Memory statistics\n" "Zebra memory\n") { show_memory_vty (vty, memory_list_zebra); return CMD_SUCCESS; @@ -377,10 +361,7 @@ DEFUN (show_memory_zebra, DEFUN (show_memory_rip, show_memory_rip_cmd, - "show memory rip", - SHOW_STR - "Memory statistics\n" - "RIP memory\n") + "show memory rip", SHOW_STR "Memory statistics\n" "RIP memory\n") { show_memory_vty (vty, memory_list_rip); return CMD_SUCCESS; @@ -388,10 +369,7 @@ DEFUN (show_memory_rip, DEFUN (show_memory_ripng, show_memory_ripng_cmd, - "show memory ripng", - SHOW_STR - "Memory statistics\n" - "RIPng memory\n") + "show memory ripng", SHOW_STR "Memory statistics\n" "RIPng memory\n") { show_memory_vty (vty, memory_list_ripng); return CMD_SUCCESS; @@ -399,10 +377,7 @@ DEFUN (show_memory_ripng, DEFUN (show_memory_bgp, show_memory_bgp_cmd, - "show memory bgp", - SHOW_STR - "Memory statistics\n" - "BGP memory\n") + "show memory bgp", SHOW_STR "Memory statistics\n" "BGP memory\n") { show_memory_vty (vty, memory_list_bgp); return CMD_SUCCESS; @@ -410,10 +385,7 @@ DEFUN (show_memory_bgp, DEFUN (show_memory_ospf, show_memory_ospf_cmd, - "show memory ospf", - SHOW_STR - "Memory statistics\n" - "OSPF memory\n") + "show memory ospf", SHOW_STR "Memory statistics\n" "OSPF memory\n") { show_memory_vty (vty, memory_list_ospf); return CMD_SUCCESS; @@ -421,10 +393,7 @@ DEFUN (show_memory_ospf, DEFUN (show_memory_ospf6, show_memory_ospf6_cmd, - "show memory ospf6", - SHOW_STR - "Memory statistics\n" - "OSPF6 memory\n") + "show memory ospf6", SHOW_STR "Memory statistics\n" "OSPF6 memory\n") { show_memory_vty (vty, memory_list_ospf6); return CMD_SUCCESS; @@ -432,10 +401,7 @@ DEFUN (show_memory_ospf6, DEFUN (show_memory_isis, show_memory_isis_cmd, - "show memory isis", - SHOW_STR - "Memory statistics\n" - "ISIS memory\n") + "show memory isis", SHOW_STR "Memory statistics\n" "ISIS memory\n") { show_memory_vty (vty, memory_list_isis); return CMD_SUCCESS; --- quagga-0.99.9/lib/memory.h 2006-06-15 05:28:59.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/memory.h 2008-04-16 11:55:47.000000000 -0700 @@ -28,7 +28,8 @@ struct memory_list const char *format; }; -struct mlist { +struct mlist +{ struct memory_list *list; const char *name; }; @@ -67,7 +68,8 @@ extern void *zrealloc (int type, void *p extern void zfree (int type, void *ptr); extern char *zstrdup (int type, const char *str); -extern void *mtype_zmalloc (const char *file, int line, int type, size_t size); +extern void *mtype_zmalloc (const char *file, int line, int type, + size_t size); extern void *mtype_zcalloc (const char *file, int line, int type, size_t num, size_t size); @@ -75,8 +77,7 @@ extern void *mtype_zcalloc (const char * extern void *mtype_zrealloc (const char *file, int line, int type, void *ptr, size_t size); -extern void mtype_zfree (const char *file, int line, int type, - void *ptr); +extern void mtype_zfree (const char *file, int line, int type, void *ptr); extern char *mtype_zstrdup (const char *file, int line, int type, const char *str); --- quagga-0.99.9/lib/memtypes.c 2007-05-04 13:15:47.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/memtypes.c 2008-04-16 11:55:47.000000000 -0700 @@ -12,8 +12,7 @@ #include "zebra.h" #include "memory.h" -struct memory_list memory_list_lib[] = -{ +struct memory_list memory_list_lib[] = { { MTYPE_TMP, "Temporary memory" }, { MTYPE_STRVEC, "String vector" }, { MTYPE_VECTOR, "Vector" }, @@ -75,8 +74,7 @@ struct memory_list memory_list_lib[] = { -1, NULL }, }; -struct memory_list memory_list_zebra[] = -{ +struct memory_list memory_list_zebra[] = { { MTYPE_RTADV_PREFIX, "Router Advertisement Prefix" }, { MTYPE_VRF, "VRF" }, { MTYPE_VRF_NAME, "VRF name" }, @@ -88,8 +86,7 @@ struct memory_list memory_list_zebra[] = { -1, NULL }, }; -struct memory_list memory_list_bgp[] = -{ +struct memory_list memory_list_bgp[] = { { MTYPE_BGP, "BGP instance" }, { MTYPE_BGP_PEER, "BGP peer" }, { MTYPE_BGP_PEER_HOST, "BGP peer hostname" }, @@ -151,8 +148,7 @@ struct memory_list memory_list_bgp[] = { -1, NULL } }; -struct memory_list memory_list_rip[] = -{ +struct memory_list memory_list_rip[] = { { MTYPE_RIP, "RIP structure" }, { MTYPE_RIP_INFO, "RIP route info" }, { MTYPE_RIP_INTERFACE, "RIP interface" }, @@ -162,8 +158,7 @@ struct memory_list memory_list_rip[] = { -1, NULL } }; -struct memory_list memory_list_ripng[] = -{ +struct memory_list memory_list_ripng[] = { { MTYPE_RIPNG, "RIPng structure" }, { MTYPE_RIPNG_ROUTE, "RIPng route info" }, { MTYPE_RIPNG_AGGREGATE, "RIPng aggregate" }, @@ -173,8 +168,7 @@ struct memory_list memory_list_ripng[] = { -1, NULL } }; -struct memory_list memory_list_ospf[] = -{ +struct memory_list memory_list_ospf[] = { { MTYPE_OSPF_TOP, "OSPF top" }, { MTYPE_OSPF_AREA, "OSPF area" }, { MTYPE_OSPF_AREA_RANGE, "OSPF area range" }, @@ -203,8 +197,7 @@ struct memory_list memory_list_ospf[] = { -1, NULL }, }; -struct memory_list memory_list_ospf6[] = -{ +struct memory_list memory_list_ospf6[] = { { MTYPE_OSPF6_TOP, "OSPF6 top" }, { MTYPE_OSPF6_AREA, "OSPF6 area" }, { MTYPE_OSPF6_IF, "OSPF6 interface" }, @@ -223,8 +216,7 @@ struct memory_list memory_list_ospf6[] = { -1, NULL }, }; -struct memory_list memory_list_isis[] = -{ +struct memory_list memory_list_isis[] = { { MTYPE_ISIS, "ISIS" }, { MTYPE_ISIS_TMP, "ISIS TMP" }, { MTYPE_ISIS_CIRCUIT, "ISIS circuit" }, @@ -242,21 +234,29 @@ struct memory_list memory_list_isis[] = { -1, NULL }, }; -struct memory_list memory_list_vtysh[] = -{ +struct memory_list memory_list_vtysh[] = { { MTYPE_VTYSH_CONFIG, "Vtysh configuration", }, { MTYPE_VTYSH_CONFIG_LINE, "Vtysh configuration line" }, { -1, NULL }, }; -struct mlist mlists[] __attribute__ ((unused)) = { - { memory_list_lib, "LIB" }, - { memory_list_zebra, "ZEBRA" }, - { memory_list_rip, "RIP" }, - { memory_list_ripng, "RIPNG" }, - { memory_list_ospf, "OSPF" }, - { memory_list_ospf6, "OSPF6" }, - { memory_list_isis, "ISIS" }, - { memory_list_bgp, "BGP" }, - { NULL, NULL}, -}; +struct mlist mlists[] __attribute__ ((unused)) = +{ + { + memory_list_lib, "LIB"}, + { + memory_list_zebra, "ZEBRA"}, + { + memory_list_rip, "RIP"}, + { + memory_list_ripng, "RIPNG"}, + { + memory_list_ospf, "OSPF"}, + { + memory_list_ospf6, "OSPF6"}, + { + memory_list_isis, "ISIS"}, + { + memory_list_bgp, "BGP"}, + { +NULL, NULL},}; --- quagga-0.99.9/lib/network.c 2005-02-16 10:27:08.000000000 -0800 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/network.c 2008-04-16 11:55:47.000000000 -0700 @@ -39,8 +39,7 @@ readn (int fd, u_char *ptr, int nbytes) if (nread < 0) return (nread); - else - if (nread == 0) + else if (nread == 0) break; nleft -= nread; --- quagga-0.99.9/lib/plist.c 2006-05-12 16:16:00.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/plist.c 2008-04-16 11:55:47.000000000 -0700 @@ -80,8 +80,7 @@ struct prefix_master }; /* Static structure of IPv4 prefix_list's master. */ -static struct prefix_master prefix_master_ipv4 = -{ +static struct prefix_master prefix_master_ipv4 = { {NULL, NULL}, {NULL, NULL}, 1, @@ -91,8 +90,7 @@ static struct prefix_master prefix_maste #ifdef HAVE_IPV6 /* Static structure of IPv6 prefix-list's master. */ -static struct prefix_master prefix_master_ipv6 = -{ +static struct prefix_master prefix_master_ipv6 = { {NULL, NULL}, {NULL, NULL}, 1, @@ -102,8 +100,7 @@ static struct prefix_master prefix_maste #endif /* HAVE_IPV6*/ /* Static structure of BGP ORF prefix_list's master. */ -static struct prefix_master prefix_master_orf = -{ +static struct prefix_master prefix_master_orf = { {NULL, NULL}, {NULL, NULL}, 1, @@ -432,8 +429,7 @@ prefix_list_entry_lookup (struct prefix_ static void prefix_list_entry_delete (struct prefix_list *plist, - struct prefix_list_entry *pentry, - int update_list) + struct prefix_list_entry *pentry, int update_list) { if (plist == NULL || pentry == NULL) return; @@ -640,8 +636,7 @@ prefix_entry_dup_check (struct prefix_li if (prefix_same (&pentry->prefix, &new->prefix) && pentry->type == new->type && pentry->le == new->le - && pentry->ge == new->ge - && pentry->seq != seq) + && pentry->ge == new->ge && pentry->seq != seq) return pentry; } return NULL; @@ -650,7 +645,8 @@ prefix_entry_dup_check (struct prefix_li static int vty_invalid_prefix_range (struct vty *vty, const char *prefix) { - vty_out (vty, "%% Invalid prefix range for %s, make sure: len < ge-value <= le-value%s", + vty_out (vty, + "%% Invalid prefix range for %s, make sure: len < ge-value <= le-value%s", prefix, VTY_NEWLINE); return CMD_WARNING; } @@ -949,8 +945,7 @@ vty_show_prefix_entry (struct vty *vty, vty_out (vty, " count: %d, range entries: %d, sequences: %d - %d%s", plist->count, plist->rangecount, plist->head ? plist->head->seq : 0, - plist->tail ? plist->tail->seq : 0, - VTY_NEWLINE); + plist->tail ? plist->tail->seq : 0, VTY_NEWLINE); } if (dtype != summary_display) @@ -1023,7 +1018,8 @@ vty_show_prefix_list (struct vty *vty, a if (dtype == detail_display || dtype == summary_display) { if (master->recent) - vty_out (vty, "Prefix-list with the last deletion/insertion: %s%s", + vty_out (vty, + "Prefix-list with the last deletion/insertion: %s%s", master->recent->name, VTY_NEWLINE); } @@ -1076,8 +1072,7 @@ vty_show_prefix_list_prefix (struct vty if (match) { vty_out (vty, " seq %d %s ", - pentry->seq, - prefix_list_type_str (pentry)); + pentry->seq, prefix_list_type_str (pentry)); if (pentry->any) vty_out (vty, "any"); @@ -1190,8 +1185,7 @@ DEFUN (ip_prefix_list_ge, "Specify packets to reject\n" "Specify packets to forward\n" "IP prefix /, e.g., 35.0.0.0/8\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") + "Minimum prefix length to be matched\n" "Minimum prefix length\n") { return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, argv[1], argv[2], argv[3], NULL); @@ -1208,8 +1202,7 @@ DEFUN (ip_prefix_list_ge_le, "IP prefix /, e.g., 35.0.0.0/8\n" "Minimum prefix length to be matched\n" "Minimum prefix length\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") + "Maximum prefix length to be matched\n" "Maximum prefix length\n") { return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, argv[1], argv[2], argv[3], argv[4]); @@ -1224,8 +1217,7 @@ DEFUN (ip_prefix_list_le, "Specify packets to reject\n" "Specify packets to forward\n" "IP prefix /, e.g., 35.0.0.0/8\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") + "Maximum prefix length to be matched\n" "Maximum prefix length\n") { return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, argv[1], argv[2], NULL, argv[3]); @@ -1242,8 +1234,7 @@ DEFUN (ip_prefix_list_le_ge, "IP prefix /, e.g., 35.0.0.0/8\n" "Maximum prefix length to be matched\n" "Maximum prefix length\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") + "Minimum prefix length to be matched\n" "Minimum prefix length\n") { return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, argv[1], argv[2], argv[4], argv[3]); @@ -1277,8 +1268,7 @@ DEFUN (ip_prefix_list_seq_ge, "Specify packets to reject\n" "Specify packets to forward\n" "IP prefix /, e.g., 35.0.0.0/8\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") + "Minimum prefix length to be matched\n" "Minimum prefix length\n") { return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2], argv[3], argv[4], NULL); @@ -1297,8 +1287,7 @@ DEFUN (ip_prefix_list_seq_ge_le, "IP prefix /, e.g., 35.0.0.0/8\n" "Minimum prefix length to be matched\n" "Minimum prefix length\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") + "Maximum prefix length to be matched\n" "Maximum prefix length\n") { return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); @@ -1315,8 +1304,7 @@ DEFUN (ip_prefix_list_seq_le, "Specify packets to reject\n" "Specify packets to forward\n" "IP prefix /, e.g., 35.0.0.0/8\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") + "Maximum prefix length to be matched\n" "Maximum prefix length\n") { return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2], argv[3], NULL, argv[4]); @@ -1335,8 +1323,7 @@ DEFUN (ip_prefix_list_seq_le_ge, "IP prefix /, e.g., 35.0.0.0/8\n" "Maximum prefix length to be matched\n" "Maximum prefix length\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") + "Minimum prefix length to be matched\n" "Minimum prefix length\n") { return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2], argv[3], argv[5], argv[4]); @@ -1345,10 +1332,7 @@ DEFUN (ip_prefix_list_seq_le_ge, DEFUN (no_ip_prefix_list, no_ip_prefix_list_cmd, "no ip prefix-list WORD", - NO_STR - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n") + NO_STR IP_STR PREFIX_LIST_STR "Name of a prefix list\n") { return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, NULL, NULL, NULL, NULL); @@ -1380,8 +1364,7 @@ DEFUN (no_ip_prefix_list_ge, "Specify packets to reject\n" "Specify packets to forward\n" "IP prefix /, e.g., 35.0.0.0/8\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") + "Minimum prefix length to be matched\n" "Minimum prefix length\n") { return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1], argv[2], argv[3], NULL); @@ -1399,8 +1382,7 @@ DEFUN (no_ip_prefix_list_ge_le, "IP prefix /, e.g., 35.0.0.0/8\n" "Minimum prefix length to be matched\n" "Minimum prefix length\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") + "Maximum prefix length to be matched\n" "Maximum prefix length\n") { return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1], argv[2], argv[3], argv[4]); @@ -1416,8 +1398,7 @@ DEFUN (no_ip_prefix_list_le, "Specify packets to reject\n" "Specify packets to forward\n" "IP prefix /, e.g., 35.0.0.0/8\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") + "Maximum prefix length to be matched\n" "Maximum prefix length\n") { return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1], argv[2], NULL, argv[3]); @@ -1435,8 +1416,7 @@ DEFUN (no_ip_prefix_list_le_ge, "IP prefix /, e.g., 35.0.0.0/8\n" "Maximum prefix length to be matched\n" "Maximum prefix length\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") + "Minimum prefix length to be matched\n" "Minimum prefix length\n") { return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1], argv[2], argv[4], argv[3]); @@ -1472,8 +1452,7 @@ DEFUN (no_ip_prefix_list_seq_ge, "Specify packets to reject\n" "Specify packets to forward\n" "IP prefix /, e.g., 35.0.0.0/8\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") + "Minimum prefix length to be matched\n" "Minimum prefix length\n") { return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2], argv[3], argv[4], NULL); @@ -1493,8 +1472,7 @@ DEFUN (no_ip_prefix_list_seq_ge_le, "IP prefix /, e.g., 35.0.0.0/8\n" "Minimum prefix length to be matched\n" "Minimum prefix length\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") + "Maximum prefix length to be matched\n" "Maximum prefix length\n") { return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); @@ -1512,8 +1490,7 @@ DEFUN (no_ip_prefix_list_seq_le, "Specify packets to reject\n" "Specify packets to forward\n" "IP prefix /, e.g., 35.0.0.0/8\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") + "Maximum prefix length to be matched\n" "Maximum prefix length\n") { return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2], argv[3], NULL, argv[4]); @@ -1533,8 +1510,7 @@ DEFUN (no_ip_prefix_list_seq_le_ge, "IP prefix /, e.g., 35.0.0.0/8\n" "Maximum prefix length to be matched\n" "Maximum prefix length\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") + "Minimum prefix length to be matched\n" "Minimum prefix length\n") { return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2], argv[3], argv[5], argv[4]); @@ -1543,9 +1519,7 @@ DEFUN (no_ip_prefix_list_seq_le_ge, DEFUN (ip_prefix_list_sequence_number, ip_prefix_list_sequence_number_cmd, "ip prefix-list sequence-number", - IP_STR - PREFIX_LIST_STR - "Include/exclude sequence numbers in NVGEN\n") + IP_STR PREFIX_LIST_STR "Include/exclude sequence numbers in NVGEN\n") { prefix_master_ipv4.seqnum = 1; return CMD_SUCCESS; @@ -1555,9 +1529,7 @@ DEFUN (no_ip_prefix_list_sequence_number no_ip_prefix_list_sequence_number_cmd, "no ip prefix-list sequence-number", NO_STR - IP_STR - PREFIX_LIST_STR - "Include/exclude sequence numbers in NVGEN\n") + IP_STR PREFIX_LIST_STR "Include/exclude sequence numbers in NVGEN\n") { prefix_master_ipv4.seqnum = 0; return CMD_SUCCESS; @@ -1592,8 +1564,7 @@ DEFUN (no_ip_prefix_list_description, NO_STR IP_STR PREFIX_LIST_STR - "Name of a prefix list\n" - "Prefix-list specific description\n") + "Name of a prefix list\n" "Prefix-list specific description\n") { return vty_prefix_list_desc_unset (vty, AFI_IP, argv[0]); } @@ -1607,13 +1578,9 @@ ALIAS (no_ip_prefix_list_description, "Name of a prefix list\n" "Prefix-list specific description\n" "Up to 80 characters describing this prefix-list\n") - DEFUN (show_ip_prefix_list, show_ip_prefix_list_cmd, - "show ip prefix-list", - SHOW_STR - IP_STR - PREFIX_LIST_STR) + "show ip prefix-list", SHOW_STR IP_STR PREFIX_LIST_STR) { return vty_show_prefix_list (vty, AFI_IP, NULL, NULL, normal_display); } @@ -1621,10 +1588,7 @@ DEFUN (show_ip_prefix_list, DEFUN (show_ip_prefix_list_name, show_ip_prefix_list_name_cmd, "show ip prefix-list WORD", - SHOW_STR - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n") + SHOW_STR IP_STR PREFIX_LIST_STR "Name of a prefix list\n") { return vty_show_prefix_list (vty, AFI_IP, argv[0], NULL, normal_display); } @@ -1636,10 +1600,10 @@ DEFUN (show_ip_prefix_list_name_seq, IP_STR PREFIX_LIST_STR "Name of a prefix list\n" - "sequence number of an entry\n" - "Sequence number\n") + "sequence number of an entry\n" "Sequence number\n") { - return vty_show_prefix_list (vty, AFI_IP, argv[0], argv[1], sequential_display); + return vty_show_prefix_list (vty, AFI_IP, argv[0], argv[1], + sequential_display); } DEFUN (show_ip_prefix_list_prefix, @@ -1651,7 +1615,8 @@ DEFUN (show_ip_prefix_list_prefix, "Name of a prefix list\n" "IP prefix /, e.g., 35.0.0.0/8\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0], argv[1], normal_display); + return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0], argv[1], + normal_display); } DEFUN (show_ip_prefix_list_prefix_longer, @@ -1664,7 +1629,8 @@ DEFUN (show_ip_prefix_list_prefix_longer "IP prefix /, e.g., 35.0.0.0/8\n" "Lookup longer prefix\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0], argv[1], longer_display); + return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0], argv[1], + longer_display); } DEFUN (show_ip_prefix_list_prefix_first_match, @@ -1677,16 +1643,14 @@ DEFUN (show_ip_prefix_list_prefix_first_ "IP prefix /, e.g., 35.0.0.0/8\n" "First matched prefix\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0], argv[1], first_match_display); + return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0], argv[1], + first_match_display); } DEFUN (show_ip_prefix_list_summary, show_ip_prefix_list_summary_cmd, "show ip prefix-list summary", - SHOW_STR - IP_STR - PREFIX_LIST_STR - "Summary of prefix lists\n") + SHOW_STR IP_STR PREFIX_LIST_STR "Summary of prefix lists\n") { return vty_show_prefix_list (vty, AFI_IP, NULL, NULL, summary_display); } @@ -1696,9 +1660,7 @@ DEFUN (show_ip_prefix_list_summary_name, "show ip prefix-list summary WORD", SHOW_STR IP_STR - PREFIX_LIST_STR - "Summary of prefix lists\n" - "Name of a prefix list\n") + PREFIX_LIST_STR "Summary of prefix lists\n" "Name of a prefix list\n") { return vty_show_prefix_list (vty, AFI_IP, argv[0], NULL, summary_display); } @@ -1707,10 +1669,7 @@ DEFUN (show_ip_prefix_list_summary_name, DEFUN (show_ip_prefix_list_detail, show_ip_prefix_list_detail_cmd, "show ip prefix-list detail", - SHOW_STR - IP_STR - PREFIX_LIST_STR - "Detail of prefix lists\n") + SHOW_STR IP_STR PREFIX_LIST_STR "Detail of prefix lists\n") { return vty_show_prefix_list (vty, AFI_IP, NULL, NULL, detail_display); } @@ -1720,19 +1679,14 @@ DEFUN (show_ip_prefix_list_detail_name, "show ip prefix-list detail WORD", SHOW_STR IP_STR - PREFIX_LIST_STR - "Detail of prefix lists\n" - "Name of a prefix list\n") + PREFIX_LIST_STR "Detail of prefix lists\n" "Name of a prefix list\n") { return vty_show_prefix_list (vty, AFI_IP, argv[0], NULL, detail_display); } DEFUN (clear_ip_prefix_list, clear_ip_prefix_list_cmd, - "clear ip prefix-list", - CLEAR_STR - IP_STR - PREFIX_LIST_STR) + "clear ip prefix-list", CLEAR_STR IP_STR PREFIX_LIST_STR) { return vty_clear_prefix_list (vty, AFI_IP, NULL, NULL); } @@ -1740,10 +1694,7 @@ DEFUN (clear_ip_prefix_list, DEFUN (clear_ip_prefix_list_name, clear_ip_prefix_list_name_cmd, "clear ip prefix-list WORD", - CLEAR_STR - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n") + CLEAR_STR IP_STR PREFIX_LIST_STR "Name of a prefix list\n") { return vty_clear_prefix_list (vty, AFI_IP, argv[0], NULL); } @@ -1785,8 +1736,7 @@ DEFUN (ipv6_prefix_list_ge, "Specify packets to reject\n" "Specify packets to forward\n" "IPv6 prefix /, e.g., 3ffe::/16\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") + "Minimum prefix length to be matched\n" "Minimum prefix length\n") { return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, argv[1], argv[2], argv[3], NULL); @@ -1803,9 +1753,7 @@ DEFUN (ipv6_prefix_list_ge_le, "IPv6 prefix /, e.g., 3ffe::/16\n" "Minimum prefix length to be matched\n" "Minimum prefix length\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") - + "Maximum prefix length to be matched\n" "Maximum prefix length\n") { return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, argv[1], argv[2], argv[3], argv[4]); @@ -1820,8 +1768,7 @@ DEFUN (ipv6_prefix_list_le, "Specify packets to reject\n" "Specify packets to forward\n" "IPv6 prefix /, e.g., 3ffe::/16\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") + "Maximum prefix length to be matched\n" "Maximum prefix length\n") { return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, argv[1], argv[2], NULL, argv[3]); @@ -1838,8 +1785,7 @@ DEFUN (ipv6_prefix_list_le_ge, "IPv6 prefix /, e.g., 3ffe::/16\n" "Maximum prefix length to be matched\n" "Maximum prefix length\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") + "Minimum prefix length to be matched\n" "Minimum prefix length\n") { return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, argv[1], argv[2], argv[4], argv[3]); @@ -1873,8 +1819,7 @@ DEFUN (ipv6_prefix_list_seq_ge, "Specify packets to reject\n" "Specify packets to forward\n" "IPv6 prefix /, e.g., 3ffe::/16\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") + "Minimum prefix length to be matched\n" "Minimum prefix length\n") { return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2], argv[3], argv[4], NULL); @@ -1893,8 +1838,7 @@ DEFUN (ipv6_prefix_list_seq_ge_le, "IPv6 prefix /, e.g., 3ffe::/16\n" "Minimum prefix length to be matched\n" "Minimum prefix length\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") + "Maximum prefix length to be matched\n" "Maximum prefix length\n") { return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); @@ -1911,8 +1855,7 @@ DEFUN (ipv6_prefix_list_seq_le, "Specify packets to reject\n" "Specify packets to forward\n" "IPv6 prefix /, e.g., 3ffe::/16\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") + "Maximum prefix length to be matched\n" "Maximum prefix length\n") { return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2], argv[3], NULL, argv[4]); @@ -1931,8 +1874,7 @@ DEFUN (ipv6_prefix_list_seq_le_ge, "IPv6 prefix /, e.g., 3ffe::/16\n" "Maximum prefix length to be matched\n" "Maximum prefix length\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") + "Minimum prefix length to be matched\n" "Minimum prefix length\n") { return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2], argv[3], argv[5], argv[4]); @@ -1941,10 +1883,7 @@ DEFUN (ipv6_prefix_list_seq_le_ge, DEFUN (no_ipv6_prefix_list, no_ipv6_prefix_list_cmd, "no ipv6 prefix-list WORD", - NO_STR - IPV6_STR - PREFIX_LIST_STR - "Name of a prefix list\n") + NO_STR IPV6_STR PREFIX_LIST_STR "Name of a prefix list\n") { return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, NULL, NULL, NULL, NULL); @@ -1976,8 +1915,7 @@ DEFUN (no_ipv6_prefix_list_ge, "Specify packets to reject\n" "Specify packets to forward\n" "IPv6 prefix /, e.g., 3ffe::/16\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") + "Minimum prefix length to be matched\n" "Minimum prefix length\n") { return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1], argv[2], argv[3], NULL); @@ -1995,8 +1933,7 @@ DEFUN (no_ipv6_prefix_list_ge_le, "IPv6 prefix /, e.g., 3ffe::/16\n" "Minimum prefix length to be matched\n" "Minimum prefix length\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") + "Maximum prefix length to be matched\n" "Maximum prefix length\n") { return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1], argv[2], argv[3], argv[4]); @@ -2012,8 +1949,7 @@ DEFUN (no_ipv6_prefix_list_le, "Specify packets to reject\n" "Specify packets to forward\n" "IPv6 prefix /, e.g., 3ffe::/16\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") + "Maximum prefix length to be matched\n" "Maximum prefix length\n") { return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1], argv[2], NULL, argv[3]); @@ -2031,8 +1967,7 @@ DEFUN (no_ipv6_prefix_list_le_ge, "IPv6 prefix /, e.g., 3ffe::/16\n" "Maximum prefix length to be matched\n" "Maximum prefix length\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") + "Minimum prefix length to be matched\n" "Minimum prefix length\n") { return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1], argv[2], argv[4], argv[3]); @@ -2068,8 +2003,7 @@ DEFUN (no_ipv6_prefix_list_seq_ge, "Specify packets to reject\n" "Specify packets to forward\n" "IPv6 prefix /, e.g., 3ffe::/16\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") + "Minimum prefix length to be matched\n" "Minimum prefix length\n") { return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2], argv[3], argv[4], NULL); @@ -2089,8 +2023,7 @@ DEFUN (no_ipv6_prefix_list_seq_ge_le, "IPv6 prefix /, e.g., 3ffe::/16\n" "Minimum prefix length to be matched\n" "Minimum prefix length\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") + "Maximum prefix length to be matched\n" "Maximum prefix length\n") { return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); @@ -2108,8 +2041,7 @@ DEFUN (no_ipv6_prefix_list_seq_le, "Specify packets to reject\n" "Specify packets to forward\n" "IPv6 prefix /, e.g., 3ffe::/16\n" - "Maximum prefix length to be matched\n" - "Maximum prefix length\n") + "Maximum prefix length to be matched\n" "Maximum prefix length\n") { return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2], argv[3], NULL, argv[4]); @@ -2129,8 +2061,7 @@ DEFUN (no_ipv6_prefix_list_seq_le_ge, "IPv6 prefix /, e.g., 3ffe::/16\n" "Maximum prefix length to be matched\n" "Maximum prefix length\n" - "Minimum prefix length to be matched\n" - "Minimum prefix length\n") + "Minimum prefix length to be matched\n" "Minimum prefix length\n") { return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2], argv[3], argv[5], argv[4]); @@ -2139,9 +2070,7 @@ DEFUN (no_ipv6_prefix_list_seq_le_ge, DEFUN (ipv6_prefix_list_sequence_number, ipv6_prefix_list_sequence_number_cmd, "ipv6 prefix-list sequence-number", - IPV6_STR - PREFIX_LIST_STR - "Include/exclude sequence numbers in NVGEN\n") + IPV6_STR PREFIX_LIST_STR "Include/exclude sequence numbers in NVGEN\n") { prefix_master_ipv6.seqnum = 1; return CMD_SUCCESS; @@ -2151,9 +2080,7 @@ DEFUN (no_ipv6_prefix_list_sequence_numb no_ipv6_prefix_list_sequence_number_cmd, "no ipv6 prefix-list sequence-number", NO_STR - IPV6_STR - PREFIX_LIST_STR - "Include/exclude sequence numbers in NVGEN\n") + IPV6_STR PREFIX_LIST_STR "Include/exclude sequence numbers in NVGEN\n") { prefix_master_ipv6.seqnum = 0; return CMD_SUCCESS; @@ -2188,8 +2115,7 @@ DEFUN (no_ipv6_prefix_list_description, NO_STR IPV6_STR PREFIX_LIST_STR - "Name of a prefix list\n" - "Prefix-list specific description\n") + "Name of a prefix list\n" "Prefix-list specific description\n") { return vty_prefix_list_desc_unset (vty, AFI_IP6, argv[0]); } @@ -2203,13 +2129,9 @@ ALIAS (no_ipv6_prefix_list_description, "Name of a prefix list\n" "Prefix-list specific description\n" "Up to 80 characters describing this prefix-list\n") - DEFUN (show_ipv6_prefix_list, show_ipv6_prefix_list_cmd, - "show ipv6 prefix-list", - SHOW_STR - IPV6_STR - PREFIX_LIST_STR) + "show ipv6 prefix-list", SHOW_STR IPV6_STR PREFIX_LIST_STR) { return vty_show_prefix_list (vty, AFI_IP6, NULL, NULL, normal_display); } @@ -2217,10 +2139,7 @@ DEFUN (show_ipv6_prefix_list, DEFUN (show_ipv6_prefix_list_name, show_ipv6_prefix_list_name_cmd, "show ipv6 prefix-list WORD", - SHOW_STR - IPV6_STR - PREFIX_LIST_STR - "Name of a prefix list\n") + SHOW_STR IPV6_STR PREFIX_LIST_STR "Name of a prefix list\n") { return vty_show_prefix_list (vty, AFI_IP6, argv[0], NULL, normal_display); } @@ -2232,10 +2151,10 @@ DEFUN (show_ipv6_prefix_list_name_seq, IPV6_STR PREFIX_LIST_STR "Name of a prefix list\n" - "sequence number of an entry\n" - "Sequence number\n") + "sequence number of an entry\n" "Sequence number\n") { - return vty_show_prefix_list (vty, AFI_IP6, argv[0], argv[1], sequential_display); + return vty_show_prefix_list (vty, AFI_IP6, argv[0], argv[1], + sequential_display); } DEFUN (show_ipv6_prefix_list_prefix, @@ -2247,7 +2166,8 @@ DEFUN (show_ipv6_prefix_list_prefix, "Name of a prefix list\n" "IPv6 prefix /, e.g., 3ffe::/16\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0], argv[1], normal_display); + return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0], argv[1], + normal_display); } DEFUN (show_ipv6_prefix_list_prefix_longer, @@ -2260,7 +2180,8 @@ DEFUN (show_ipv6_prefix_list_prefix_long "IPv6 prefix /, e.g., 3ffe::/16\n" "Lookup longer prefix\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0], argv[1], longer_display); + return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0], argv[1], + longer_display); } DEFUN (show_ipv6_prefix_list_prefix_first_match, @@ -2273,16 +2194,14 @@ DEFUN (show_ipv6_prefix_list_prefix_firs "IPv6 prefix /, e.g., 3ffe::/16\n" "First matched prefix\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0], argv[1], first_match_display); + return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0], argv[1], + first_match_display); } DEFUN (show_ipv6_prefix_list_summary, show_ipv6_prefix_list_summary_cmd, "show ipv6 prefix-list summary", - SHOW_STR - IPV6_STR - PREFIX_LIST_STR - "Summary of prefix lists\n") + SHOW_STR IPV6_STR PREFIX_LIST_STR "Summary of prefix lists\n") { return vty_show_prefix_list (vty, AFI_IP6, NULL, NULL, summary_display); } @@ -2292,9 +2211,7 @@ DEFUN (show_ipv6_prefix_list_summary_nam "show ipv6 prefix-list summary WORD", SHOW_STR IPV6_STR - PREFIX_LIST_STR - "Summary of prefix lists\n" - "Name of a prefix list\n") + PREFIX_LIST_STR "Summary of prefix lists\n" "Name of a prefix list\n") { return vty_show_prefix_list (vty, AFI_IP6, argv[0], NULL, summary_display); } @@ -2302,10 +2219,7 @@ DEFUN (show_ipv6_prefix_list_summary_nam DEFUN (show_ipv6_prefix_list_detail, show_ipv6_prefix_list_detail_cmd, "show ipv6 prefix-list detail", - SHOW_STR - IPV6_STR - PREFIX_LIST_STR - "Detail of prefix lists\n") + SHOW_STR IPV6_STR PREFIX_LIST_STR "Detail of prefix lists\n") { return vty_show_prefix_list (vty, AFI_IP6, NULL, NULL, detail_display); } @@ -2315,19 +2229,14 @@ DEFUN (show_ipv6_prefix_list_detail_name "show ipv6 prefix-list detail WORD", SHOW_STR IPV6_STR - PREFIX_LIST_STR - "Detail of prefix lists\n" - "Name of a prefix list\n") + PREFIX_LIST_STR "Detail of prefix lists\n" "Name of a prefix list\n") { return vty_show_prefix_list (vty, AFI_IP6, argv[0], NULL, detail_display); } DEFUN (clear_ipv6_prefix_list, clear_ipv6_prefix_list_cmd, - "clear ipv6 prefix-list", - CLEAR_STR - IPV6_STR - PREFIX_LIST_STR) + "clear ipv6 prefix-list", CLEAR_STR IPV6_STR PREFIX_LIST_STR) { return vty_clear_prefix_list (vty, AFI_IP6, NULL, NULL); } @@ -2335,10 +2244,7 @@ DEFUN (clear_ipv6_prefix_list, DEFUN (clear_ipv6_prefix_list_name, clear_ipv6_prefix_list_name_cmd, "clear ipv6 prefix-list WORD", - CLEAR_STR - IPV6_STR - PREFIX_LIST_STR - "Name of a prefix list\n") + CLEAR_STR IPV6_STR PREFIX_LIST_STR "Name of a prefix list\n") { return vty_clear_prefix_list (vty, AFI_IP6, argv[0], NULL); } @@ -2389,8 +2295,7 @@ config_write_prefix_afi (afi_t afi, stru for (pentry = plist->head; pentry; pentry = pentry->next) { vty_out (vty, "ip%s prefix-list %s ", - afi == AFI_IP ? "" : "v6", - plist->name); + afi == AFI_IP ? "" : "v6", plist->name); if (master->seqnum) vty_out (vty, "seq %d ", pentry->seq); @@ -2432,8 +2337,7 @@ config_write_prefix_afi (afi_t afi, stru for (pentry = plist->head; pentry; pentry = pentry->next) { vty_out (vty, "ip%s prefix-list %s ", - afi == AFI_IP ? "" : "v6", - plist->name); + afi == AFI_IP ? "" : "v6", plist->name); if (master->seqnum) vty_out (vty, "seq %d ", pentry->seq); @@ -2478,8 +2382,7 @@ prefix_bgp_orf_entry (struct stream *s, u_char flag = init_flag; struct prefix *p = &pentry->prefix; - flag |= (pentry->type == PREFIX_PERMIT ? - permit_flag : deny_flag); + flag |= (pentry->type == PREFIX_PERMIT ? permit_flag : deny_flag); stream_putc (s, flag); stream_putl (s, (u_int32_t)pentry->seq); stream_putc (s, (u_char)pentry->ge); @@ -2529,8 +2432,9 @@ prefix_bgp_orf_set (char *name, afi_t af else { pentry = prefix_list_entry_lookup (plist, &orfp->p, - (permit ? PREFIX_PERMIT : PREFIX_DENY), - orfp->seq, orfp->le, orfp->ge); + (permit ? PREFIX_PERMIT : + PREFIX_DENY), orfp->seq, orfp->le, + orfp->ge); if (! pentry) return CMD_WARNING; @@ -2566,8 +2470,7 @@ prefix_bgp_show_prefix_list (struct vty return plist->count; vty_out (vty, "ip%s prefix-list %s: %d entries%s", - afi == AFI_IP ? "" : "v6", - plist->name, plist->count, VTY_NEWLINE); + afi == AFI_IP ? "" : "v6", plist->name, plist->count, VTY_NEWLINE); for (pentry = plist->head; pentry; pentry = pentry->next) { @@ -2623,8 +2526,7 @@ prefix_list_reset_orf (void) /* Prefix-list node. */ -struct cmd_node prefix_node = -{ +struct cmd_node prefix_node = { PREFIX_NODE, "", /* Prefix list has no interface. */ 1 @@ -2732,8 +2634,7 @@ prefix_list_init_ipv4 (void) #ifdef HAVE_IPV6 /* Prefix-list node. */ -struct cmd_node prefix_ipv6_node = -{ +struct cmd_node prefix_ipv6_node = { PREFIX_IPV6_NODE, "", /* Prefix list has no interface. */ 1 @@ -2828,7 +2729,8 @@ prefix_list_init_ipv6 (void) install_element (ENABLE_NODE, &show_ipv6_prefix_list_name_seq_cmd); install_element (ENABLE_NODE, &show_ipv6_prefix_list_prefix_cmd); install_element (ENABLE_NODE, &show_ipv6_prefix_list_prefix_longer_cmd); - install_element (ENABLE_NODE, &show_ipv6_prefix_list_prefix_first_match_cmd); + install_element (ENABLE_NODE, + &show_ipv6_prefix_list_prefix_first_match_cmd); install_element (ENABLE_NODE, &show_ipv6_prefix_list_summary_cmd); install_element (ENABLE_NODE, &show_ipv6_prefix_list_summary_name_cmd); install_element (ENABLE_NODE, &show_ipv6_prefix_list_detail_cmd); --- quagga-0.99.9/lib/prefix.c 2005-07-28 17:14:23.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/prefix.c 2008-04-16 11:55:47.000000000 -0700 @@ -30,7 +30,8 @@ /* Maskbit. */ static u_char maskbit[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0, - 0xf8, 0xfc, 0xfe, 0xff}; + 0xf8, 0xfc, 0xfe, 0xff +}; /* Number of bits in prefix type. */ #ifndef PNBBY @@ -512,8 +513,7 @@ apply_mask (struct prefix *p) /* Utility function of convert between struct prefix <=> union sockunion. * FIXME This function isn't used anywhere. */ struct prefix * -sockunion2prefix (const union sockunion *dest, - const union sockunion *mask) +sockunion2prefix (const union sockunion *dest, const union sockunion *mask) { if (dest->sa.sa_family == AF_INET) { @@ -646,7 +646,8 @@ all_digit (const char *str) } /* Utility function to convert ipv4 prefixes to Classful prefixes */ -void apply_classful_mask_ipv4 (struct prefix_ipv4 *p) +void +apply_classful_mask_ipv4 (struct prefix_ipv4 *p) { u_int32_t destination; --- quagga-0.99.9/lib/privs.c 2006-03-30 05:21:35.000000000 -0800 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/privs.c 2008-04-16 11:55:47.000000000 -0700 @@ -40,7 +40,8 @@ */ #ifdef HAVE_LCAPS /* Linux doesn't have a 'set' type: a set of related privileges */ -struct _pset { +struct _pset +{ int num; cap_value_t *caps; }; @@ -100,38 +101,101 @@ static struct } cap_map [ZCAP_MAX] = { #ifdef HAVE_LCAPS /* Quagga -> Linux capabilities mappings */ - [ZCAP_SETID] = { 2, (pvalue_t []) { CAP_SETGID, - CAP_SETUID }, }, - [ZCAP_BIND] = { 2, (pvalue_t []) { CAP_NET_BIND_SERVICE, - CAP_NET_BROADCAST }, }, - [ZCAP_NET_ADMIN] = { 1, (pvalue_t []) { CAP_NET_ADMIN }, }, - [ZCAP_NET_RAW] = { 1, (pvalue_t []) { CAP_NET_RAW }, }, - [ZCAP_CHROOT] = { 1, (pvalue_t []) { CAP_SYS_CHROOT, }, }, - [ZCAP_NICE] = { 1, (pvalue_t []) { CAP_SYS_NICE }, }, - [ZCAP_PTRACE] = { 1, (pvalue_t []) { CAP_SYS_PTRACE }, }, - [ZCAP_DAC_OVERRIDE] = { 1, (pvalue_t []) { CAP_DAC_OVERRIDE }, }, - [ZCAP_READ_SEARCH] = { 1, (pvalue_t []) { CAP_DAC_READ_SEARCH }, }, - [ZCAP_SYS_ADMIN] = { 1, (pvalue_t []) { CAP_SYS_ADMIN }, }, - [ZCAP_FOWNER] = { 1, (pvalue_t []) { CAP_FOWNER }, }, + [ZCAP_SETID] = + { + 2, (pvalue_t[]) + { + CAP_SETGID, CAP_SETUID},},[ZCAP_BIND] = + { + 2, (pvalue_t[]) + { + CAP_NET_BIND_SERVICE, CAP_NET_BROADCAST},},[ZCAP_NET_ADMIN] = + { + 1, (pvalue_t[]) + { + CAP_NET_ADMIN},},[ZCAP_NET_RAW] = + { + 1, (pvalue_t[]) + { + CAP_NET_RAW},},[ZCAP_CHROOT] = + { + 1, (pvalue_t[]) + { + CAP_SYS_CHROOT,},},[ZCAP_NICE] = + { + 1, (pvalue_t[]) + { + CAP_SYS_NICE},},[ZCAP_PTRACE] = + { + 1, (pvalue_t[]) + { + CAP_SYS_PTRACE},},[ZCAP_DAC_OVERRIDE] = + { + 1, (pvalue_t[]) + { + CAP_DAC_OVERRIDE},},[ZCAP_READ_SEARCH] = + { + 1, (pvalue_t[]) + { + CAP_DAC_READ_SEARCH},},[ZCAP_SYS_ADMIN] = + { + 1, (pvalue_t[]) + { + CAP_SYS_ADMIN},},[ZCAP_FOWNER] = + { + 1, (pvalue_t[]) + { + CAP_FOWNER},}, #elif defined(HAVE_SOLARIS_CAPABILITIES) /* HAVE_LCAPS */ /* Quagga -> Solaris privilege mappings */ - [ZCAP_SETID] = { 1, (pvalue_t []) { PRIV_PROC_SETID }, }, - [ZCAP_BIND] = { 1, (pvalue_t []) { PRIV_NET_PRIVADDR }, }, - [ZCAP_NET_ADMIN] = { 1, (pvalue_t []) { PRIV_SYS_NET_CONFIG }, }, - [ZCAP_NET_RAW] = { 2, (pvalue_t []) { PRIV_NET_RAWACCESS, - PRIV_NET_ICMPACCESS }, }, - [ZCAP_CHROOT] = { 1, (pvalue_t []) { PRIV_PROC_CHROOT }, }, - [ZCAP_NICE] = { 1, (pvalue_t []) { PRIV_PROC_PRIOCNTL }, }, - [ZCAP_PTRACE] = { 1, (pvalue_t []) { PRIV_PROC_SESSION }, }, - [ZCAP_DAC_OVERRIDE] = { 2, (pvalue_t []) { PRIV_FILE_DAC_EXECUTE, + [ZCAP_SETID] = + { + 1, (pvalue_t[]) + { + PRIV_PROC_SETID},},[ZCAP_BIND] = + { + 1, (pvalue_t[]) + { + PRIV_NET_PRIVADDR},},[ZCAP_NET_ADMIN] = + { + 1, (pvalue_t[]) + { + PRIV_SYS_NET_CONFIG},},[ZCAP_NET_RAW] = + { + 2, (pvalue_t[]) + { + PRIV_NET_RAWACCESS, PRIV_NET_ICMPACCESS},},[ZCAP_CHROOT] = + { + 1, (pvalue_t[]) + { + PRIV_PROC_CHROOT},},[ZCAP_NICE] = + { + 1, (pvalue_t[]) + { + PRIV_PROC_PRIOCNTL},},[ZCAP_PTRACE] = + { + 1, (pvalue_t[]) + { + PRIV_PROC_SESSION},},[ZCAP_DAC_OVERRIDE] = + { + 2, (pvalue_t[]) + { + PRIV_FILE_DAC_EXECUTE, PRIV_FILE_DAC_READ, PRIV_FILE_DAC_SEARCH, - PRIV_FILE_DAC_WRITE, - PRIV_FILE_DAC_SEARCH }, }, - [ZCAP_READ_SEARCH] = { 2, (pvalue_t []) { PRIV_FILE_DAC_SEARCH, - PRIV_FILE_DAC_READ }, }, - [ZCAP_SYS_ADMIN] = { 1, (pvalue_t []) { PRIV_SYS_ADMIN }, }, - [ZCAP_FOWNER] = { 1, (pvalue_t []) { PRIV_FILE_OWNER }, }, + PRIV_FILE_DAC_WRITE, PRIV_FILE_DAC_SEARCH},},[ZCAP_READ_SEARCH] = + { + 2, (pvalue_t[]) + { + PRIV_FILE_DAC_SEARCH, PRIV_FILE_DAC_READ},},[ZCAP_SYS_ADMIN] = + { + 1, (pvalue_t[]) + { + PRIV_SYS_ADMIN},},[ZCAP_FOWNER] = + { + 1, (pvalue_t[]) + { + PRIV_FILE_OWNER},}, #endif /* HAVE_SOLARIS_CAPABILITIES */ }; @@ -197,8 +261,7 @@ zprivs_change_caps (zebra_privs_ops_t op if ( !cap_set_flag (zprivs_state.caps, CAP_EFFECTIVE, zprivs_state.syscaps_p->num, - zprivs_state.syscaps_p->caps, - cflag)) + zprivs_state.syscaps_p->caps, cflag)) return cap_set_proc (zprivs_state.caps); return -1; } @@ -277,16 +340,14 @@ zprivs_caps_init (struct zebra_privs_t * /* set permitted caps */ cap_set_flag(zprivs_state.caps, CAP_PERMITTED, zprivs_state.syscaps_p->num, - zprivs_state.syscaps_p->caps, - CAP_SET); + zprivs_state.syscaps_p->caps, CAP_SET); /* set inheritable caps, if any */ if (zprivs_state.syscaps_i && zprivs_state.syscaps_i->num) { cap_set_flag(zprivs_state.caps, CAP_INHERITABLE, zprivs_state.syscaps_i->num, - zprivs_state.syscaps_i->caps, - CAP_SET); + zprivs_state.syscaps_i->caps, CAP_SET); } /* apply caps. CAP_EFFECTIVE is cleared. we'll raise the caps as @@ -444,8 +505,7 @@ zprivs_caps_init (struct zebra_privs_t * if (!zprivs_state.syscaps_p) { fprintf (stderr, "%s: capabilities enabled, " - "but no valid capabilities supplied\n", - __func__); + "but no valid capabilities supplied\n", __func__); } /* We retain the basic set in our permitted set, as Linux has no --- quagga-0.99.9/lib/privs.h 2005-09-29 07:41:07.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/privs.h 2008-04-16 11:55:47.000000000 -0700 @@ -64,10 +64,8 @@ struct zebra_privs_t const char *group; const char *vty_group; /* group to chown vty socket to */ /* methods */ - int - (*change) (zebra_privs_ops_t); /* change privileges, 0 on success */ - zebra_privs_current_t - (*current_state) (void); /* current privilege state */ + int (*change) (zebra_privs_ops_t); /* change privileges, 0 on success */ + zebra_privs_current_t (*current_state) (void); /* current privilege state */ }; struct zprivs_ids_t --- quagga-0.99.9/lib/regex.c 2006-01-31 12:55:53.000000000 -0800 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/regex.c 2008-04-16 11:55:47.000000000 -0700 @@ -734,8 +733,7 @@ print_partial_compiled_pattern (start, e assert (p + *p < pend); for (c = 0; c < 256; c++) - if (c / 8 < *p - && (p[1 + (c/8)] & (1 << (c % 8)))) + if (c / 8 < *p && (p[1 + (c / 8)] & (1 << (c % 8)))) { /* Are we starting a range? */ if (last + 1 == c && ! in_range) @@ -1011,14 +1010,11 @@ re_set_syntax (syntax) #ifdef _LIBC weak_alias (__re_set_syntax, re_set_syntax) #endif - /* This table gives an error message for each of the error codes listed in regex.h. Obviously the order here has to be same as there. POSIX doesn't require that we do anything for REG_NOERROR, but why not be nice? */ - -static const char re_error_msgid[] = - { + static const char re_error_msgid[] = { #define REG_NOERROR_IDX 0 gettext_noop ("Success") /* REG_NOERROR */ "\0" @@ -1071,8 +1067,7 @@ static const char re_error_msgid[] = gettext_noop ("Unmatched ) or \\)"), /* REG_ERPAREN */ }; -static const size_t re_error_msgid_idx[] = - { +static const size_t re_error_msgid_idx[] = { REG_NOERROR_IDX, REG_NOMATCH_IDX, REG_BADPAT_IDX, @@ -1558,25 +1553,25 @@ static char reg_unset_dummy; /* Subroutine declarations and macros for regex_compile. */ -static reg_errcode_t regex_compile _RE_ARGS ((const char *pattern, size_t size, - reg_syntax_t syntax, +static reg_errcode_t regex_compile +_RE_ARGS ((const char *pattern, size_t size, reg_syntax_t syntax, struct re_pattern_buffer *bufp)); -static void store_op1 _RE_ARGS ((re_opcode_t op, unsigned char *loc, int arg)); -static void store_op2 _RE_ARGS ((re_opcode_t op, unsigned char *loc, - int arg1, int arg2)); -static void insert_op1 _RE_ARGS ((re_opcode_t op, unsigned char *loc, - int arg, unsigned char *end)); -static void insert_op2 _RE_ARGS ((re_opcode_t op, unsigned char *loc, - int arg1, int arg2, unsigned char *end)); -static boolean at_begline_loc_p _RE_ARGS ((const char *pattern, const char *p, - reg_syntax_t syntax)); -static boolean at_endline_loc_p _RE_ARGS ((const char *p, const char *pend, - reg_syntax_t syntax)); -static reg_errcode_t compile_range _RE_ARGS ((const char **p_ptr, - const char *pend, - char *translate, - reg_syntax_t syntax, - unsigned char *b)); +static void store_op1 +_RE_ARGS ((re_opcode_t op, unsigned char *loc, int arg)); +static void store_op2 +_RE_ARGS ((re_opcode_t op, unsigned char *loc, int arg1, int arg2)); +static void insert_op1 +_RE_ARGS ((re_opcode_t op, unsigned char *loc, int arg, unsigned char *end)); +static void insert_op2 +_RE_ARGS ((re_opcode_t op, unsigned char *loc, int arg1, int arg2, + unsigned char *end)); +static boolean at_begline_loc_p +_RE_ARGS ((const char *pattern, const char *p, reg_syntax_t syntax)); +static boolean at_endline_loc_p +_RE_ARGS ((const char *p, const char *pend, reg_syntax_t syntax)); +static reg_errcode_t compile_range +_RE_ARGS ((const char **p_ptr, const char *pend, char *translate, + reg_syntax_t syntax, unsigned char *b)); /* Fetch the next character in the uncompiled pattern---translating it if necessary. Also cast from a signed character in the constant @@ -1990,7 +1985,8 @@ regex_compile (pattern, size, syntax, bu { /* Caller did not allocate a buffer. Do it for them. */ bufp->buffer = TALLOC (INIT_BUF_SIZE, unsigned char); } - if (!bufp->buffer) FREE_STACK_RETURN (REG_ESPACE); + if (!bufp->buffer) + FREE_STACK_RETURN (REG_ESPACE); bufp->allocated = INIT_BUF_SIZE; } @@ -2036,8 +2032,7 @@ regex_compile (pattern, size, syntax, bu case '+': case '?': - if ((syntax & RE_BK_PLUS_QM) - || (syntax & RE_LIMITED_OPS)) + if ((syntax & RE_BK_PLUS_QM) || (syntax & RE_LIMITED_OPS)) goto normal_char; handle_plus: case '*': @@ -2078,7 +2073,8 @@ regex_compile (pattern, size, syntax, bu else if (syntax & RE_BK_PLUS_QM && c == '\\') { - if (p == pend) FREE_STACK_RETURN (REG_EESCAPE); + if (p == pend) + FREE_STACK_RETURN (REG_EESCAPE); PATFETCH (c1); if (!(c1 == '+' || c1 == '?')) @@ -2147,8 +2143,7 @@ regex_compile (pattern, size, syntax, bu end of the buffer after this jump is inserted. */ GET_BUFFER_SPACE (3); INSERT_JUMP (keep_string_p ? on_failure_keep_string_jump - : on_failure_jump, - laststart, b + 3); + : on_failure_jump, laststart, b + 3); pending_exact = 0; b += 3; @@ -2177,7 +2172,8 @@ regex_compile (pattern, size, syntax, bu { boolean had_char_class = false; - if (p == pend) FREE_STACK_RETURN (REG_EBRACK); + if (p == pend) + FREE_STACK_RETURN (REG_EBRACK); /* Ensure that we have enough space to push a charset: the opcode, the length count, and the bitset; 34 bytes in all. */ @@ -2208,14 +2204,16 @@ regex_compile (pattern, size, syntax, bu /* Read in characters and ranges, setting map bits. */ for (;;) { - if (p == pend) FREE_STACK_RETURN (REG_EBRACK); + if (p == pend) + FREE_STACK_RETURN (REG_EBRACK); PATFETCH (c); /* \ might escape characters inside [...] and [^...]. */ if ((syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && c == '\\') { - if (p == pend) FREE_STACK_RETURN (REG_EESCAPE); + if (p == pend) + FREE_STACK_RETURN (REG_EESCAPE); PATFETCH (c1); SET_LIST_BIT (c1); @@ -2244,7 +2242,8 @@ regex_compile (pattern, size, syntax, bu { reg_errcode_t ret = compile_range (&p, pend, translate, syntax, b); - if (ret != REG_NOERROR) FREE_STACK_RETURN (ret); + if (ret != REG_NOERROR) + FREE_STACK_RETURN (ret); } else if (p[0] == '-' && p[1] != ']') @@ -2255,7 +2254,8 @@ regex_compile (pattern, size, syntax, bu PATFETCH (c1); ret = compile_range (&p, pend, translate, syntax, b); - if (ret != REG_NOERROR) FREE_STACK_RETURN (ret); + if (ret != REG_NOERROR) + FREE_STACK_RETURN (ret); } /* See if we're at the beginning of a possible character @@ -2269,7 +2269,8 @@ regex_compile (pattern, size, syntax, bu c1 = 0; /* If pattern is `[[:'. */ - if (p == pend) FREE_STACK_RETURN (REG_EBRACK); + if (p == pend) + FREE_STACK_RETURN (REG_EBRACK); for (;;) { @@ -2303,7 +2304,8 @@ regex_compile (pattern, size, syntax, bu class. */ PATFETCH (c); - if (p == pend) FREE_STACK_RETURN (REG_EBRACK); + if (p == pend) + FREE_STACK_RETURN (REG_EBRACK); for (ch = 0; ch < 1 << BYTEWIDTH; ++ch) { @@ -2343,7 +2345,8 @@ regex_compile (pattern, size, syntax, bu class. */ PATFETCH (c); - if (p == pend) FREE_STACK_RETURN (REG_EBRACK); + if (p == pend) + FREE_STACK_RETURN (REG_EBRACK); for (ch = 0; ch < 1 << BYTEWIDTH; ch++) { @@ -2433,7 +2436,8 @@ regex_compile (pattern, size, syntax, bu case '\\': - if (p == pend) FREE_STACK_RETURN (REG_EESCAPE); + if (p == pend) + FREE_STACK_RETURN (REG_EESCAPE); /* Do not translate the character after the \, so that we can distinguish, e.g., \B from \b, even if we normally would @@ -2454,7 +2458,8 @@ regex_compile (pattern, size, syntax, bu { RETALLOC (compile_stack.stack, compile_stack.size << 1, compile_stack_elt_t); - if (compile_stack.stack == NULL) return REG_ESPACE; + if (compile_stack.stack == NULL) + return REG_ESPACE; compile_stack.size <<= 1; } @@ -2492,7 +2497,8 @@ regex_compile (pattern, size, syntax, bu case ')': - if (syntax & RE_NO_BK_PARENS) goto normal_backslash; + if (syntax & RE_NO_BK_PARENS) + goto normal_backslash; if (COMPILE_STACK_EMPTY) { @@ -2537,8 +2543,7 @@ regex_compile (pattern, size, syntax, bu begalt = bufp->buffer + COMPILE_STACK_TOP.begalt_offset; fixup_alt_jump = COMPILE_STACK_TOP.fixup_alt_jump - ? bufp->buffer + COMPILE_STACK_TOP.fixup_alt_jump - 1 - : 0; + ? bufp->buffer + COMPILE_STACK_TOP.fixup_alt_jump - 1 : 0; laststart = bufp->buffer + COMPILE_STACK_TOP.laststart_offset; this_group_regnum = COMPILE_STACK_TOP.regnum; /* If we've reached MAX_REGNUM groups, then this open @@ -2637,7 +2642,8 @@ regex_compile (pattern, size, syntax, bu if (c == ',') { GET_UNSIGNED_NUMBER (upper_bound); - if (upper_bound < 0) upper_bound = RE_DUP_MAX; + if (upper_bound < 0) + upper_bound = RE_DUP_MAX; } else /* Interval such as `{1}' => match exactly once. */ @@ -2654,7 +2660,8 @@ regex_compile (pattern, size, syntax, bu if (!(syntax & RE_NO_BK_BRACES)) { - if (c != '\\') FREE_STACK_RETURN (REG_EBRACE); + if (c != '\\') + FREE_STACK_RETURN (REG_EBRACE); PATFETCH (c); } @@ -2712,8 +2719,7 @@ regex_compile (pattern, size, syntax, bu because `re_compile_fastmap' needs to know. Jump to the `jump_n' we might insert below. */ INSERT_JUMP2 (succeed_n, laststart, - b + 5 + (upper_bound > 1) * 5, - lower_bound); + b + 5 + (upper_bound > 1) * 5, lower_bound); b += 5; /* Code to initialize the lower bound. Insert @@ -2848,8 +2854,15 @@ regex_compile (pattern, size, syntax, bu BUF_PUSH (endbuf); break; - case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': if (syntax & RE_NO_BK_REFS) goto normal_char; @@ -2904,8 +2914,7 @@ regex_compile (pattern, size, syntax, bu : (*p == '+' || *p == '?')) || ((syntax & RE_INTERVALS) && ((syntax & RE_NO_BK_BRACES) - ? *p == '{' - : (p[0] == '\\' && p[1] == '{')))) + ? *p == '{' : (p[0] == '\\' && p[1] == '{')))) { /* Start building a new exactn. */ @@ -3113,8 +3122,7 @@ group_in_compile_stack (compile_stack, r int this_element; for (this_element = compile_stack.avail - 1; - this_element >= 0; - this_element--) + this_element >= 0; this_element--) if (compile_stack.stack[this_element].regnum == regnum) return true; @@ -3484,7 +3493,6 @@ re_compile_fastmap (bufp) #ifdef _LIBC weak_alias (__re_compile_fastmap, re_compile_fastmap) #endif - /* Set REGS to hold NUM_REGS registers, storing them in STARTS and ENDS. Subsequent matches using PATTERN_BUFFER and REGS will use this memory for recording register information. STARTS and ENDS @@ -3497,9 +3505,7 @@ weak_alias (__re_compile_fastmap, re_com Unless this function is called, the first search or match using PATTERN_BUFFER will allocate its own register data, without freeing the old data. */ - -void -re_set_registers (bufp, regs, num_regs, starts, ends) + void re_set_registers (bufp, regs, num_regs, starts, ends) struct re_pattern_buffer *bufp; struct re_registers *regs; unsigned num_regs; @@ -3522,14 +3529,10 @@ re_set_registers (bufp, regs, num_regs, #ifdef _LIBC weak_alias (__re_set_registers, re_set_registers) #endif - /* Searching routines. */ - /* Like re_search_2, below, but only one string is specified, and doesn't let you say where to stop matching. */ - -int -re_search (bufp, string, size, startpos, range, regs) + int re_search (bufp, string, size, startpos, range, regs) struct re_pattern_buffer *bufp; const char *string; int size, startpos, range; @@ -3563,9 +3565,9 @@ weak_alias (__re_search, re_search) We return either the position in the strings at which the match was found, -1 if no match, or -2 if error (such as failure stack overflow). */ - int -re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop) + re_search_2 (bufp, string1, size1, string2, size2, startpos, range, + regs, stop) struct re_pattern_buffer *bufp; const char *string1, *string2; int size1, size2; @@ -3594,11 +3596,10 @@ re_search_2 (bufp, string1, size1, strin /* If the search isn't to be a backwards one, don't waste time in a search for a pattern that must be anchored. */ - if (bufp->used > 0 && range > 0 - && ((re_opcode_t) bufp->buffer[0] == begbuf + if (bufp->used > 0 && range > 0 && ((re_opcode_t) bufp->buffer[0] == begbuf /* `begline' is like `begbuf' if it cannot match at newlines. */ - || ((re_opcode_t) bufp->buffer[0] == begline - && !bufp->newline_anchor))) + || ((re_opcode_t) bufp->buffer[0] == + begline && !bufp->newline_anchor))) { if (startpos > 0) return -1; @@ -3704,7 +3706,6 @@ re_search_2 (bufp, string1, size1, strin #ifdef _LIBC weak_alias (__re_search_2, re_search_2) #endif - /* This converts PTR, a pointer into one of the search strings `string1' and `string2' into an offset from the beginning of that string. */ #define POINTER_TO_OFFSET(ptr) \ @@ -3783,14 +3774,10 @@ weak_alias (__re_search_2, re_search_2) to actually save any registers when none are active. */ #define NO_HIGHEST_ACTIVE_REG (1 << BYTEWIDTH) #define NO_LOWEST_ACTIVE_REG (NO_HIGHEST_ACTIVE_REG + 1) - /* Matching routines. */ - #ifndef emacs /* Emacs never uses this. */ /* re_match is like re_match_2 except it takes only a single string. */ - -int -re_match (bufp, string, size, pos, regs) + int re_match (bufp, string, size, pos, regs) struct re_pattern_buffer *bufp; const char *string; int size, pos; @@ -3809,18 +3797,18 @@ re_match (bufp, string, size, pos, regs) weak_alias (__re_match, re_match) # endif #endif /* not emacs */ - static boolean group_match_null_string_p _RE_ARGS ((unsigned char **p, unsigned char *end, + register_info_type * + reg_info)); + static boolean alt_match_null_string_p + _RE_ARGS ((unsigned char *p, unsigned char *end, register_info_type *reg_info)); -static boolean alt_match_null_string_p _RE_ARGS ((unsigned char *p, - unsigned char *end, - register_info_type *reg_info)); -static boolean common_op_match_null_string_p _RE_ARGS ((unsigned char **p, - unsigned char *end, + static boolean common_op_match_null_string_p + _RE_ARGS ((unsigned char **p, unsigned char *end, register_info_type *reg_info)); -static int bcmp_translate _RE_ARGS ((const char *s1, const char *s2, - int len, char *translate)); + static int bcmp_translate + _RE_ARGS ((const char *s1, const char *s2, int len, char *translate)); /* re_match_2 matches the compiled pattern in BUFP against the the (virtual) concatenation of STRING1 and STRING2 (of length SIZE1 @@ -3835,8 +3823,7 @@ static int bcmp_translate _RE_ARGS ((con failure stack overflowing). Otherwise, we return the length of the matched substring. */ -int -re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) + int re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) struct re_pattern_buffer *bufp; const char *string1, *string2; int size1, size2; @@ -3860,7 +3847,8 @@ weak_alias (__re_match_2, re_match_2) /* This is a separate function so that we can force an alloca cleanup afterwards. */ static int -re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) + re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, + stop) struct re_pattern_buffer *bufp; const char *string1, *string2; int size1, size2; @@ -4261,8 +4249,7 @@ re_match_2_internal (bufp, string1, size DEBUG_PRINT2 ("%u registers pushed.\n", num_regs_pushed); mcnt = d - pos - (MATCHING_IN_FIRST_STRING - ? string1 - : string2 - size1); + ? string1 : string2 - size1); DEBUG_PRINT2 ("Returning %d from re_match_2.\n", mcnt); @@ -4308,7 +4295,8 @@ re_match_2_internal (bufp, string1, size do { PREFETCH (); - if (*d++ != (char) *p++) goto fail; + if (*d++ != (char) *p++) + goto fail; } while (--mcnt); } @@ -4351,7 +4339,8 @@ re_match_2_internal (bufp, string1, size p += 1 + *p; - if (!not) goto fail; + if (!not) + goto fail; SET_REGS_MATCHED (); d++; @@ -4370,9 +4359,10 @@ re_match_2_internal (bufp, string1, size /* Find out if this group can match the empty string. */ p1 = p; /* To send to group_match_null_string_p. */ - if (REG_MATCH_NULL_STRING_P (reg_info[*p]) == MATCH_NULL_UNSET_VALUE) - REG_MATCH_NULL_STRING_P (reg_info[*p]) - = group_match_null_string_p (&p1, pend, reg_info); + if (REG_MATCH_NULL_STRING_P (reg_info[*p]) == + MATCH_NULL_UNSET_VALUE) + REG_MATCH_NULL_STRING_P (reg_info[*p]) = + group_match_null_string_p (&p1, pend, reg_info); /* Save the position in the string where we were the last time we were at this open-group operator in case the group is @@ -4380,8 +4370,7 @@ re_match_2_internal (bufp, string1, size against `ab'; then we want to ignore where we are now in the string in case this attempt to match fails. */ old_regstart[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p]) - ? REG_UNSET (regstart[*p]) ? d : regstart[*p] - : regstart[*p]; + ? REG_UNSET (regstart[*p]) ? d : regstart[*p] : regstart[*p]; DEBUG_PRINT2 (" old_regstart: %d\n", POINTER_TO_OFFSET (old_regstart[*p])); @@ -4421,8 +4410,7 @@ re_match_2_internal (bufp, string1, size against `aba'; then we want to ignore where we are now in the string in case this attempt to match fails. */ old_regend[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p]) - ? REG_UNSET (regend[*p]) ? d : regend[*p] - : regend[*p]; + ? REG_UNSET (regend[*p]) ? d : regend[*p] : regend[*p]; DEBUG_PRINT2 (" old_regend: %d\n", POINTER_TO_OFFSET (old_regend[*p])); @@ -4473,8 +4461,7 @@ re_match_2_internal (bufp, string1, size information for this group that we had before trying this last match. */ if ((!MATCHED_SOMETHING (reg_info[*p]) - || just_past_start_mem == p - 1) - && (p + 2) < pend) + || just_past_start_mem == p - 1) && (p + 2) < pend) { boolean is_a_jump_n = false; @@ -4575,15 +4562,18 @@ re_match_2_internal (bufp, string1, size contents. */ while (d2 == dend2) { - if (dend2 == end_match_2) break; - if (dend2 == regend[regno]) break; + if (dend2 == end_match_2) + break; + if (dend2 == regend[regno]) + break; /* End of string1 => advance to string2. */ d2 = string2; dend2 = regend[regno]; } /* At end of register contents => success */ - if (d2 == dend2) break; + if (d2 == dend2) + break; /* If necessary, advance to next segment in data. */ PREFETCH (); @@ -4619,7 +4609,8 @@ re_match_2_internal (bufp, string1, size if (AT_STRINGS_BEG (d)) { - if (!bufp->not_bol) break; + if (!bufp->not_bol) + break; } else if (d[-1] == '\n' && bufp->newline_anchor) { @@ -4635,7 +4626,8 @@ re_match_2_internal (bufp, string1, size if (AT_STRINGS_END (d)) { - if (!bufp->not_eol) break; + if (!bufp->not_eol) + break; } /* We have to ``prefetch'' the next character. */ @@ -4805,7 +4797,8 @@ re_match_2_internal (bufp, string1, size } else if ((re_opcode_t) *p2 == exactn - || (bufp->newline_anchor && (re_opcode_t) *p2 == endline)) + || (bufp->newline_anchor + && (re_opcode_t) * p2 == endline)) { register unsigned char c = *p2 == (unsigned char) endline ? '\n' : p2[2]; @@ -4882,8 +4875,7 @@ re_match_2_internal (bufp, string1, size /* We win if the charset inside the loop has no overlap with the one after the loop. */ for (idx = 0; - idx < (int) p2[1] && idx < (int) p1[4]; - idx++) + idx < (int) p2[1] && idx < (int) p1[4]; idx++) if ((p2[2 + idx] & p1[5 + idx]) != 0) break; @@ -5006,7 +4998,8 @@ re_match_2_internal (bufp, string1, size #ifdef _LIBC DEBUG_PRINT2 (" Setting two bytes from %p to no_op.\n", p+2); #else - DEBUG_PRINT2 (" Setting two bytes from 0x%x to no_op.\n", p+2); + DEBUG_PRINT2 (" Setting two bytes from 0x%x to no_op.\n", + p + 2); #endif p[2] = (unsigned char) no_op; p[3] = (unsigned char) no_op; @@ -5313,8 +5306,7 @@ group_match_null_string_p (p, end, reg_i is, including the ending `jump_past_alt' and its number. */ - if (!alt_match_null_string_p (p1, p1 + mcnt - 3, - reg_info)) + if (!alt_match_null_string_p (p1, p1 + mcnt - 3, reg_info)) return false; /* Move to right after this alternative, including the @@ -5444,7 +5436,8 @@ common_op_match_null_string_p (p, end, r /* Have to set this here in case we're checking a group which contains a group and a back reference to it. */ - if (REG_MATCH_NULL_STRING_P (reg_info[reg_no]) == MATCH_NULL_UNSET_VALUE) + if (REG_MATCH_NULL_STRING_P (reg_info[reg_no]) == + MATCH_NULL_UNSET_VALUE) REG_MATCH_NULL_STRING_P (reg_info[reg_no]) = ret; if (!ret) @@ -5506,7 +5499,8 @@ bcmp_translate (s1, s2, len, translate) register const unsigned char *p2 = (const unsigned char *) s2; while (len) { - if (translate[*p1++] != translate[*p2++]) return 1; + if (translate[*p1++] != translate[*p2++]) + return 1; len--; } return 0; @@ -5552,12 +5547,9 @@ re_compile_pattern (pattern, length, buf #ifdef _LIBC weak_alias (__re_compile_pattern, re_compile_pattern) #endif - /* Entry points compatible with 4.2 BSD regex library. We don't define them unless specifically requested. */ - #if defined _REGEX_RE_COMP || defined _LIBC - /* BSD has one and only one pattern buffer. */ static struct re_pattern_buffer re_comp_buf; @@ -5718,7 +5710,8 @@ regcomp (preg, pattern, cflags) /* POSIX doesn't distinguish between an unmatched open-group and an unmatched close-group: both are REG_EPAREN. */ - if (ret == REG_ERPAREN) ret = REG_EPAREN; + if (ret == REG_ERPAREN) + ret = REG_EPAREN; if (ret == REG_NOERROR && preg->fastmap) { @@ -5753,9 +5745,7 @@ weak_alias (__regcomp, regcomp) string; if REG_NOTEOL is set, then $ does not match at the end. We return 0 if we find a match and REG_NOMATCH if not. */ - -int -regexec (preg, string, nmatch, pmatch, eflags) + int regexec (preg, string, nmatch, pmatch, eflags) const regex_t *preg; const char *string; size_t nmatch; @@ -5864,12 +5853,8 @@ regerror (err, preg, errbuf, errbuf_size #ifdef _LIBC weak_alias (__regerror, regerror) #endif - - /* Free dynamically allocated space used by PREG. */ - -void -regfree (preg) + void regfree (preg) regex_t *preg; { if (preg->buffer != NULL) --- quagga-0.99.9/lib/regex-gnu.h 2002-12-13 12:15:29.000000000 -0800 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/regex-gnu.h 2008-04-16 11:55:47.000000000 -0700 @@ -25,7 +25,8 @@ /* Allow the use in C++ code. */ #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif /* POSIX says that must be included (by the caller) before @@ -454,7 +455,8 @@ extern const char *re_compile_pattern /* Compile a fastmap for the compiled pattern in BUFFER; used to accelerate searches. Return 0 if successful and -2 if was an internal error. */ -extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer)); + extern int re_compile_fastmap + _RE_ARGS ((struct re_pattern_buffer * buffer)); /* Search in the string STRING (with length LENGTH) for the pattern --- quagga-0.99.9/lib/routemap.c 2007-05-02 08:28:32.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/routemap.c 2008-04-16 11:55:47.000000000 -0700 @@ -67,11 +67,9 @@ struct route_map_list static struct route_map_list route_map_master = { NULL, NULL, NULL, NULL }; static void -route_map_rule_delete (struct route_map_rule_list *, - struct route_map_rule *); +route_map_rule_delete (struct route_map_rule_list *, struct route_map_rule *); -static void -route_map_index_delete (struct route_map_index *, int); +static void route_map_index_delete (struct route_map_index *, int); /* New route map allocation. Please note route map's name must be specified. */ @@ -334,8 +332,7 @@ route_map_index_lookup (struct route_map struct route_map_index *index; for (index = map->head; index; index = index->next) - if ((index->type == type || type == RMAP_ANY) - && index->pref == pref) + if ((index->type == type || type == RMAP_ANY) && index->pref == pref) return index; return NULL; } @@ -386,8 +383,7 @@ route_map_index_add (struct route_map *m /* Execute event hook. */ if (route_map_master.event_hook) - (*route_map_master.event_hook) (RMAP_EVENT_INDEX_ADDED, - map->name); + (*route_map_master.event_hook) (RMAP_EVENT_INDEX_ADDED, map->name); return index; } @@ -574,8 +570,7 @@ route_map_add_match (struct route_map_in if (route_map_master.event_hook) (*route_map_master.event_hook) (replaced ? RMAP_EVENT_MATCH_REPLACED: - RMAP_EVENT_MATCH_ADDED, - index->map->name); + RMAP_EVENT_MATCH_ADDED, index->map->name); return 0; } @@ -661,8 +656,7 @@ route_map_add_set (struct route_map_inde if (route_map_master.event_hook) (*route_map_master.event_hook) (replaced ? RMAP_EVENT_SET_REPLACED: - RMAP_EVENT_SET_ADDED, - index->map->name); + RMAP_EVENT_SET_ADDED, index->map->name); return 0; } @@ -944,16 +938,14 @@ DEFUN (no_route_map_all, no_route_map_all_cmd, "no route-map WORD", NO_STR - "Create route-map or enter route-map command mode\n" - "Route map tag\n") + "Create route-map or enter route-map command mode\n" "Route map tag\n") { struct route_map *map; map = route_map_lookup_by_name (argv[0]); if (map == NULL) { - vty_out (vty, "%% Could not find route-map %s%s", - argv[0], VTY_NEWLINE); + vty_out (vty, "%% Could not find route-map %s%s", argv[0], VTY_NEWLINE); return CMD_WARNING; } @@ -1007,8 +999,7 @@ DEFUN (no_route_map, map = route_map_lookup_by_name (argv[0]); if (map == NULL) { - vty_out (vty, "%% Could not find route-map %s%s", - argv[0], VTY_NEWLINE); + vty_out (vty, "%% Could not find route-map %s%s", argv[0], VTY_NEWLINE); return CMD_WARNING; } @@ -1033,9 +1024,7 @@ DEFUN (no_route_map, DEFUN (rmap_onmatch_next, rmap_onmatch_next_cmd, - "on-match next", - "Exit policy on matches\n" - "Next clause\n") + "on-match next", "Exit policy on matches\n" "Next clause\n") { struct route_map_index *index; @@ -1049,10 +1038,7 @@ DEFUN (rmap_onmatch_next, DEFUN (no_rmap_onmatch_next, no_rmap_onmatch_next_cmd, - "no on-match next", - NO_STR - "Exit policy on matches\n" - "Next clause\n") + "no on-match next", NO_STR "Exit policy on matches\n" "Next clause\n") { struct route_map_index *index; @@ -1067,9 +1053,7 @@ DEFUN (no_rmap_onmatch_next, DEFUN (rmap_onmatch_goto, rmap_onmatch_goto_cmd, "on-match goto <1-65535>", - "Exit policy on matches\n" - "Goto Clause number\n" - "Number\n") + "Exit policy on matches\n" "Goto Clause number\n" "Number\n") { struct route_map_index *index = vty->index; int d = 0; @@ -1084,8 +1068,7 @@ DEFUN (rmap_onmatch_goto, if (d <= index->pref) { /* Can't allow you to do that, Dave */ - vty_out (vty, "can't jump backwards in route-maps%s", - VTY_NEWLINE); + vty_out (vty, "can't jump backwards in route-maps%s", VTY_NEWLINE); return CMD_WARNING; } else @@ -1100,9 +1083,7 @@ DEFUN (rmap_onmatch_goto, DEFUN (no_rmap_onmatch_goto, no_rmap_onmatch_goto_cmd, "no on-match goto", - NO_STR - "Exit policy on matches\n" - "Goto Clause number\n") + NO_STR "Exit policy on matches\n" "Goto Clause number\n") { struct route_map_index *index; @@ -1123,9 +1103,7 @@ ALIAS (rmap_onmatch_goto, ALIAS (no_rmap_onmatch_goto, no_rmap_continue_cmd, "no continue", - NO_STR - "Continue on a different entry within the route-map\n") - + NO_STR "Continue on a different entry within the route-map\n") /* GNU Zebra compatible */ ALIAS (rmap_onmatch_goto, rmap_continue_seq_cmd, @@ -1143,9 +1119,7 @@ ALIAS (no_rmap_onmatch_goto, DEFUN (rmap_show_name, rmap_show_name_cmd, "show route-map [WORD]", - SHOW_STR - "route-map information\n" - "route-map name\n") + SHOW_STR "route-map information\n" "route-map name\n") { const char *name = NULL; if (argc) @@ -1179,9 +1152,7 @@ DEFUN (rmap_call, DEFUN (no_rmap_call, no_rmap_call_cmd, - "no call", - NO_STR - "Jump to another Route-Map after match+set\n") + "no call", NO_STR "Jump to another Route-Map after match+set\n") { struct route_map_index *index; @@ -1199,8 +1170,7 @@ DEFUN (no_rmap_call, DEFUN (rmap_description, rmap_description_cmd, "description .LINE", - "Route-map comment\n" - "Comment describing this route-map rule\n") + "Route-map comment\n" "Comment describing this route-map rule\n") { struct route_map_index *index; @@ -1216,9 +1186,7 @@ DEFUN (rmap_description, DEFUN (no_rmap_description, no_rmap_description_cmd, - "no description", - NO_STR - "Route-map comment\n") + "no description", NO_STR "Route-map comment\n") { struct route_map_index *index; @@ -1252,21 +1220,18 @@ route_map_config_write (struct vty *vty) vty_out (vty, "route-map %s %s %d%s", map->name, - route_map_type_str (index->type), - index->pref, VTY_NEWLINE); + route_map_type_str (index->type), index->pref, VTY_NEWLINE); if (index->description) vty_out (vty, " description %s%s", index->description, VTY_NEWLINE); for (rule = index->match_list.head; rule; rule = rule->next) vty_out (vty, " match %s %s%s", rule->cmd->str, - rule->rule_str ? rule->rule_str : "", - VTY_NEWLINE); + rule->rule_str ? rule->rule_str : "", VTY_NEWLINE); for (rule = index->set_list.head; rule; rule = rule->next) vty_out (vty, " set %s %s%s", rule->cmd->str, - rule->rule_str ? rule->rule_str : "", - VTY_NEWLINE); + rule->rule_str ? rule->rule_str : "", VTY_NEWLINE); if (index->nextrm) vty_out (vty, " call %s%s", index->nextrm, VTY_NEWLINE); if (index->exitpolicy == RMAP_GOTO) @@ -1280,8 +1245,7 @@ route_map_config_write (struct vty *vty) } /* Route map node structure. */ -struct cmd_node rmap_node = -{ +struct cmd_node rmap_node = { RMAP_NODE, "%s(config-route-map)# ", 1 --- quagga-0.99.9/lib/routemap.h 2007-05-02 08:28:32.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/routemap.h 2008-04-16 11:55:47.000000000 -0700 @@ -166,13 +166,11 @@ extern int route_map_delete_match (struc /* Add route-map set statement to the route map. */ extern int route_map_add_set (struct route_map_index *index, - const char *set_name, - const char *set_arg); + const char *set_name, const char *set_arg); /* Delete route map set rule. */ extern int route_map_delete_set (struct route_map_index *index, - const char *set_name, - const char *set_arg); + const char *set_name, const char *set_arg); /* Install rule command to the match list. */ extern void route_map_install_match (struct route_map_rule_cmd *cmd); @@ -191,6 +189,7 @@ extern route_map_result_t route_map_appl extern void route_map_add_hook (void (*func) (const char *)); extern void route_map_delete_hook (void (*func) (const char *)); -extern void route_map_event_hook (void (*func) (route_map_event_t, const char *)); +extern void +route_map_event_hook (void (*func) (route_map_event_t, const char *)); #endif /* _ZEBRA_ROUTEMAP_H */ --- quagga-0.99.9/lib/sigevent.c 2005-05-03 11:02:06.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/sigevent.c 2008-04-16 11:55:47.000000000 -0700 @@ -130,7 +130,8 @@ quagga_signal_timer (struct thread *t) int i; sigm = THREAD_ARG (t); - sigm->t = thread_add_timer (sigm->t->master, quagga_signal_timer, &sigmaster, + sigm->t = + thread_add_timer (sigm->t->master, quagga_signal_timer, &sigmaster, QUAGGA_SIGNAL_TIMER_INTERVAL); return quagga_sigevent_process (); } @@ -148,11 +149,14 @@ signal_set (int signo) sig.sa_handler = &quagga_signal_handler; sigfillset (&sig.sa_mask); sig.sa_flags = 0; - if (signo == SIGALRM) { + if (signo == SIGALRM) + { #ifdef SA_INTERRUPT sig.sa_flags |= SA_INTERRUPT; /* SunOS */ #endif - } else { + } + else + { #ifdef SA_RESTART sig.sa_flags |= SA_RESTART; #endif /* SA_RESTART */ @@ -185,10 +189,10 @@ program_counter(void *context) #endif /* SA_SIGINFO */ -static void __attribute__ ((noreturn)) -exit_handler(int signo +static void __attribute__ ((noreturn)) exit_handler (int signo #ifdef SA_SIGINFO - , siginfo_t *siginfo, void *context + , siginfo_t * siginfo, + void *context #endif ) { @@ -200,10 +204,10 @@ exit_handler(int signo _exit(128+signo); } -static void __attribute__ ((noreturn)) -core_handler(int signo +static void __attribute__ ((noreturn)) core_handler (int signo #ifdef SA_SIGINFO - , siginfo_t *siginfo, void *context + , siginfo_t * siginfo, + void *context #endif ) { @@ -257,7 +261,8 @@ trap_default_signals(void) static const int ignore_signals[] = { SIGPIPE, }; - static const struct { + static const struct + { const int *sigs; u_int nsigs; void (*handler)(int signo @@ -265,11 +270,20 @@ trap_default_signals(void) , siginfo_t *info, void *context #endif ); - } sigmap[] = { - { core_signals, sizeof(core_signals)/sizeof(core_signals[0]), core_handler}, - { exit_signals, sizeof(exit_signals)/sizeof(exit_signals[0]), exit_handler}, - { ignore_signals, sizeof(ignore_signals)/sizeof(ignore_signals[0]), NULL}, - }; + } sigmap[] = + { + { + core_signals, sizeof (core_signals) / sizeof (core_signals[0]), + core_handler} + , + { + exit_signals, sizeof (exit_signals) / sizeof (exit_signals[0]), + exit_handler} + , + { + ignore_signals, sizeof (ignore_signals) / sizeof (ignore_signals[0]), + NULL} + ,}; u_int i; for (i = 0; i < sizeof(sigmap)/sizeof(sigmap[0]); i++) --- quagga-0.99.9/lib/smux.c 2007-05-09 13:59:34.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/smux.c 2008-04-16 11:55:47.000000000 -0700 @@ -40,7 +40,8 @@ #define min(A,B) ((A) < (B) ? (A) : (B)) -enum smux_event {SMUX_SCHEDULE, SMUX_CONNECT, SMUX_READ}; +enum smux_event +{ SMUX_SCHEDULE, SMUX_CONNECT, SMUX_READ }; void smux_event (enum smux_event, int); @@ -71,8 +72,7 @@ int debug_smux = 0; int fail = 0; /* SMUX node. */ -struct cmd_node smux_node = -{ +struct cmd_node smux_node = { SMUX_NODE, "" /* SMUX has no interface. */ }; @@ -252,7 +252,8 @@ smux_socket () sockopt_reuseaddr (sock); sockopt_reuseport (sock); - ret = connect (sock, (struct sockaddr *) &serv, sizeof (struct sockaddr_in)); + ret = + connect (sock, (struct sockaddr *) &serv, sizeof (struct sockaddr_in)); if (ret < 0) { close (sock); @@ -308,15 +309,15 @@ smux_getresp_send (oid objid[], size_t o h2 = ptr; /* Place holder h2 for one variable */ ptr = asn_build_sequence (ptr, &len, - (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR), - 0); + (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR), 0); h2e = ptr; ptr = snmp_build_var_op (ptr, objid, &objid_len, val_type, arg_len, arg, &len); /* Now variable size is known, fill in size */ - asn_build_sequence(h2,&length,(u_char)(ASN_SEQUENCE|ASN_CONSTRUCTOR),ptr-h2e); + asn_build_sequence (h2, &length, (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR), + ptr - h2e); /* Fill in size of whole sequence */ asn_build_sequence(h1,&length,(u_char)SMUX_GETRSP,ptr-h1e); @@ -329,9 +330,7 @@ smux_getresp_send (oid objid[], size_t o char * smux_var (char *ptr, size_t len, oid objid[], size_t *objid_len, - size_t *var_val_len, - u_char *var_val_type, - void **var_value) + size_t * var_val_len, u_char * var_val_type, void **var_value) { u_char type; u_char val_type; @@ -689,8 +688,9 @@ smux_parse_set (char *ptr, size_t len, i if (debug_smux) zlog_debug ("SMUX SET(%s) message parse: len %ld", - (RESERVE1 == action) ? "RESERVE1" : ((FREE == action) ? "FREE" : "COMMIT"), - len); + (RESERVE1 == + action) ? "RESERVE1" : ((FREE == + action) ? "FREE" : "COMMIT"), len); /* Parse SET message header. */ ptr = smux_parse_get_header (ptr, &len, &reqid); @@ -810,11 +810,13 @@ process_rest: /* see note below: YYY */ if (sout_save_len > 0) { - smux_parse_set (sout_save_buff, sout_save_len, rollback ? FREE : COMMIT); + smux_parse_set (sout_save_buff, sout_save_len, + rollback ? FREE : COMMIT); sout_save_len = 0; } else - zlog_warn ("SMUX_SOUT sout_save_len=%d - invalid", (int) sout_save_len); + zlog_warn ("SMUX_SOUT sout_save_len=%d - invalid", + (int) sout_save_len); if (len_income > 3) { @@ -1043,14 +1045,13 @@ smux_trap (oid *name, size_t namelen, /* Timeticks timestamp. */ val = 0; ptr = asn_build_unsigned_int (ptr, &len, - (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_TIMETICKS), - &val, sizeof (val)); + (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | + ASN_TIMETICKS), &val, sizeof (val)); /* Variables. */ h1 = ptr; ptr = asn_build_sequence (ptr, &len, - (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR), - 0); + (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR), 0); /* Iteration for each objects. */ @@ -1075,7 +1076,8 @@ smux_trap (oid *name, size_t namelen, else { oid_copy (oid, name, namelen); - oid_copy (oid + namelen, trapobj[i].name, trapobj[i].namelen * (-1)); + oid_copy (oid + namelen, trapobj[i].name, + trapobj[i].namelen * (-1)); oid_len = namelen + trapobj[i].namelen * (-1) ; } @@ -1106,8 +1108,7 @@ smux_trap (oid *name, size_t namelen, /* Now variable size is known, fill in size */ asn_build_sequence(h1, &length, - (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR), - ptr - h1e); + (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR), ptr - h1e); /* Fill in size of whole sequence */ len = BUFSIZ; @@ -1147,18 +1148,21 @@ smux_register (int sock) /* Priority. */ priority = -1; ptr = asn_build_int (ptr, &len, - (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), - &priority, sizeof (priority)); + (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | + ASN_INTEGER), &priority, + sizeof (priority)); /* Operation. */ operation = 2; /* Register R/W */ ptr = asn_build_int (ptr, &len, - (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), - &operation, sizeof (operation)); + (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | + ASN_INTEGER), &operation, + sizeof (operation)); if (debug_smux) { - smux_oid_dump ("SMUX register oid", subtree->name, subtree->name_len); + smux_oid_dump ("SMUX register oid", subtree->name, + subtree->name_len); zlog_debug ("SMUX register priority: %ld", priority); zlog_debug ("SMUX register operation: %ld", operation); } @@ -1209,7 +1213,8 @@ smux_connect (struct thread *t) ret = smux_register (smux_sock); if (ret < 0) { - zlog_warn ("SMUX register message send failed: %s", safe_strerror (errno)); + zlog_warn ("SMUX register message send failed: %s", + safe_strerror (errno)); close (smux_sock); smux_sock = -1; if (++fail < SMUX_MAX_FAILURE) @@ -1353,8 +1358,8 @@ smux_peer_oid (struct vty *vty, const ch } int -smux_header_generic (struct variable *v, oid *name, size_t *length, int exact, - size_t *var_len, WriteMethod **write_method) +smux_header_generic (struct variable *v, oid * name, size_t * length, + int exact, size_t * var_len, WriteMethod ** write_method) { oid fulloid[MAX_OID_LEN]; int ret; @@ -1401,8 +1406,7 @@ DEFUN (smux_peer, smux_peer_cmd, "smux peer OID", "SNMP MUX protocol settings\n" - "SNMP MUX peer settings\n" - "Object ID used in SMUX peering\n") + "SNMP MUX peer settings\n" "Object ID used in SMUX peering\n") { if (smux_peer_oid (vty, argv[0], NULL) == 0) { @@ -1418,8 +1422,7 @@ DEFUN (smux_peer_password, "smux peer OID PASSWORD", "SNMP MUX protocol settings\n" "SNMP MUX peer settings\n" - "SMUX peering object ID\n" - "SMUX peering password\n") + "SMUX peering object ID\n" "SMUX peering password\n") { if (smux_peer_oid (vty, argv[0], argv[1]) == 0) { @@ -1433,9 +1436,7 @@ DEFUN (smux_peer_password, DEFUN (no_smux_peer, no_smux_peer_cmd, "no smux peer", - NO_STR - "SNMP MUX protocol settings\n" - "SNMP MUX peer settings\n") + NO_STR "SNMP MUX protocol settings\n" "SNMP MUX peer settings\n") { smux_stop(); return smux_peer_default (); @@ -1455,11 +1455,8 @@ ALIAS (no_smux_peer, NO_STR "SNMP MUX protocol settings\n" "SNMP MUX peer settings\n" - "SMUX peering object ID\n" - "SMUX peering password\n") - -int -config_write_smux (struct vty *vty) + "SMUX peering object ID\n" "SMUX peering password\n") + int config_write_smux (struct vty *vty) { int first = 1; unsigned int i; @@ -1480,8 +1477,7 @@ config_write_smux (struct vty *vty) /* Register subtree to smux master tree. */ void smux_register_mib (const char *descr, struct variable *var, - size_t width, int num, - oid name[], size_t namelen) + size_t width, int num, oid name[], size_t namelen) { struct subtree *tree; --- quagga-0.99.9/lib/smux.h 2005-10-03 07:20:30.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/smux.h 2008-04-16 11:55:47.000000000 -0700 @@ -67,9 +67,7 @@ typedef int (WriteMethod)(int action, u_char var_val_type, size_t var_val_len, u_char *statP, - oid *name, - size_t length, - struct variable *v); + oid * name, size_t length, struct variable * v); typedef u_char *(FindVarMethod)(struct variable *v, oid *name, --- quagga-0.99.9/lib/sockopt.c 2007-08-22 09:22:54.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/sockopt.c 2008-04-16 11:55:47.000000000 -0700 @@ -72,8 +72,7 @@ getsockopt_cmsg_data (struct msghdr *msg void *ptr = NULL; for (cmsg = ZCMSG_FIRSTHDR(msgh); - cmsg != NULL; - cmsg = CMSG_NXTHDR(msgh, cmsg)) + cmsg != NULL; cmsg = CMSG_NXTHDR (msgh, cmsg)) if (cmsg->cmsg_level == level && cmsg->cmsg_type) return (ptr = CMSG_DATA(cmsg)); @@ -90,7 +89,8 @@ setsockopt_ipv6_pktinfo (int sock, int v #ifdef IPV6_RECVPKTINFO /*2292bis-01*/ ret = setsockopt(sock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &val, sizeof(val)); if (ret < 0) - zlog_warn ("can't setsockopt IPV6_RECVPKTINFO : %s", safe_strerror (errno)); + zlog_warn ("can't setsockopt IPV6_RECVPKTINFO : %s", + safe_strerror (errno)); #else /*RFC2292*/ ret = setsockopt(sock, IPPROTO_IPV6, IPV6_PKTINFO, &val, sizeof(val)); if (ret < 0) @@ -121,7 +121,8 @@ setsockopt_ipv6_multicast_hops (int sock { int ret; - ret = setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &val, sizeof(val)); + ret = + setsockopt (sock, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &val, sizeof (val)); if (ret < 0) zlog_warn ("can't setsockopt IPV6_MULTICAST_HOPS"); return ret; @@ -133,7 +134,8 @@ setsockopt_ipv6_unicast_hops (int sock, { int ret; - ret = setsockopt(sock, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &val, sizeof(val)); + ret = + setsockopt (sock, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &val, sizeof (val)); if (ret < 0) zlog_warn ("can't setsockopt IPV6_UNICAST_HOPS"); return ret; @@ -145,7 +147,8 @@ setsockopt_ipv6_hoplimit (int sock, int int ret; #ifdef IPV6_RECVHOPLIMIT /*2292bis-01*/ - ret = setsockopt (sock, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &val, sizeof(val)); + ret = + setsockopt (sock, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &val, sizeof (val)); if (ret < 0) zlog_warn ("can't setsockopt IPV6_RECVHOPLIMIT"); #else /*RFC2292*/ @@ -206,12 +209,11 @@ int setsockopt_multicast_ipv4(int sock, int optname, struct in_addr if_addr /* required */, - unsigned int mcast_addr, - unsigned int ifindex /* optional: if non-zero, may be + unsigned int mcast_addr, unsigned int ifindex /* optional: if non-zero, may be used instead of if_addr */) { -#ifdef HAVE_STRUCT_IP_MREQN_IMR_IFINDEX +#ifdef GNU_LINUX /* This is better because it uses ifindex directly */ struct ip_mreqn mreqn; int ret; @@ -233,7 +235,8 @@ setsockopt_multicast_ipv4(int sock, ret = setsockopt(sock, IPPROTO_IP, optname, (void *)&mreqn, sizeof(mreqn)); - if ((ret < 0) && (optname == IP_ADD_MEMBERSHIP) && (errno == EADDRINUSE)) + if ((ret < 0) && (optname == IP_ADD_MEMBERSHIP) + && (errno == EADDRINUSE)) { /* see above: handle possible problem when interface comes back up */ char buf[2][INET_ADDRSTRLEN]; @@ -263,6 +266,95 @@ setsockopt_multicast_ipv4(int sock, /* #elif defined(BOGON_NIX) && EXAMPLE_VERSION_CODE > -100000 */ /* Add your favourite OS here! */ +#elif __FreeBSD__ == 7 + + struct ip_mreqn mreqn; + struct group_req gr; + struct sockaddr_in *si; + int ret; + + switch (optname) + { + case IP_MULTICAST_IF: + memset (&mreqn, 0, sizeof (mreqn)); + + if (mcast_addr) + mreqn.imr_multiaddr.s_addr = mcast_addr; + + if (ifindex) + mreqn.imr_ifindex = ifindex; + else + mreqn.imr_address = if_addr; + + ret = setsockopt (sock, IPPROTO_IP, optname, + (void *) &mreqn, sizeof (mreqn)); + return ret; + break; + + case IP_ADD_MEMBERSHIP: + case IP_DROP_MEMBERSHIP: + if (ifindex) + { + memset (&gr, 0, sizeof (gr)); + si = (struct sockaddr_in *) &gr.gr_group; + gr.gr_interface = ifindex; + if (mcast_addr) + si->sin_family = AF_INET; + si->sin_len = sizeof (struct sockaddr_in); + si->sin_addr.s_addr = mcast_addr; + if (optname == IP_ADD_MEMBERSHIP) + ret = setsockopt (sock, IPPROTO_IP, MCAST_JOIN_GROUP, + (void *) &gr, sizeof (gr)); + else + ret = setsockopt (sock, IPPROTO_IP, MCAST_LEAVE_GROUP, + (void *) &gr, sizeof (gr)); + } + else + { + memset (&mreqn, 0, sizeof (mreqn)); + if (mcast_addr) + mreqn.imr_multiaddr.s_addr = mcast_addr; + mreqn.imr_address = if_addr; + + ret = setsockopt (sock, IPPROTO_IP, optname, + (void *) &mreqn, sizeof (mreqn)); + } + if ((ret < 0) && (optname == IP_ADD_MEMBERSHIP) + && (errno == EADDRINUSE)) + { + /* see above: handle possible problem when interface comes back up */ + char buf[2][INET_ADDRSTRLEN]; + zlog_info ("setsockopt_multicast_ipv4 attempting to drop and " + "re-add (fd %d, ifaddr %s, mcast %s, ifindex %u)", + sock, + inet_ntop (AF_INET, &if_addr, buf[0], sizeof (buf[0])), + inet_ntop (AF_INET, &mcast_addr, buf[1], + sizeof (buf[1])), ifindex); + if (ifindex) + { + setsockopt (sock, IPPROTO_IP, MCAST_LEAVE_GROUP, + (void *) &gr, sizeof (gr)); + ret = setsockopt (sock, IPPROTO_IP, MCAST_JOIN_GROUP, + (void *) &gr, sizeof (gr)); + } + else + { + setsockopt (sock, IPPROTO_IP, IP_DROP_MEMBERSHIP, + (void *) &mreqn, sizeof (mreqn)); + ret = setsockopt (sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, + (void *) &mreqn, sizeof (mreqn)); + } + } + return ret; + break; + + default: + /* Can out and give an understandable error */ + errno = EINVAL; + return -1; + break; + } + #else /* #if OS_TYPE */ /* standard BSD API */ @@ -289,8 +381,10 @@ setsockopt_multicast_ipv4(int sock, mreq.imr_multiaddr.s_addr = mcast_addr; mreq.imr_interface = m; - ret = setsockopt (sock, IPPROTO_IP, optname, (void *)&mreq, sizeof(mreq)); - if ((ret < 0) && (optname == IP_ADD_MEMBERSHIP) && (errno == EADDRINUSE)) + ret = + setsockopt (sock, IPPROTO_IP, optname, (void *) &mreq, sizeof (mreq)); + if ((ret < 0) && (optname == IP_ADD_MEMBERSHIP) + && (errno == EADDRINUSE)) { /* see above: handle possible problem when interface comes back up */ char buf[2][INET_ADDRSTRLEN]; @@ -324,13 +418,15 @@ setsockopt_ipv4_ifindex (int sock, int v int ret; #if defined (IP_PKTINFO) - if ((ret = setsockopt (sock, IPPROTO_IP, IP_PKTINFO, &val, sizeof (val))) < 0) - zlog_warn ("Can't set IP_PKTINFO option for fd %d to %d: %s", - sock,val,safe_strerror(errno)); + if ((ret = + setsockopt (sock, IPPROTO_IP, IP_PKTINFO, &val, sizeof (val))) < 0) + zlog_warn ("Can't set IP_PKTINFO option for fd %d to %d: %s", sock, val, + safe_strerror (errno)); #elif defined (IP_RECVIF) - if ((ret = setsockopt (sock, IPPROTO_IP, IP_RECVIF, &val, sizeof (val))) < 0) - zlog_warn ("Can't set IP_RECVIF option for fd %d to %d: %s", - sock,val,safe_strerror(errno)); + if ((ret = + setsockopt (sock, IPPROTO_IP, IP_RECVIF, &val, sizeof (val))) < 0) + zlog_warn ("Can't set IP_RECVIF option for fd %d to %d: %s", sock, val, + safe_strerror (errno)); #else #warning "Neither IP_PKTINFO nor IP_RECVIF is available." #warning "Will not be able to receive link info." --- quagga-0.99.9/lib/sockunion.c 2007-05-09 13:59:34.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/sockunion.c 2008-04-16 11:55:47.000000000 -0700 @@ -42,8 +42,16 @@ inet_aton (const char *cp, struct in_add switch (c) { - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': val = (val * base) + (c - '0'); break; case '.': @@ -58,7 +66,8 @@ inet_aton (const char *cp, struct in_add default: return 0; } - } while (*cp++) ; + } + while (*cp++); if (dots < 3) addr <<= 8 * (3 - dots); @@ -236,7 +245,8 @@ sockunion_socket (union sockunion *su) sock = socket (su->sa.sa_family, SOCK_STREAM, 0); if (sock < 0) { - zlog (NULL, LOG_WARNING, "Can't make socket : %s", safe_strerror (errno)); + zlog (NULL, LOG_WARNING, "Can't make socket : %s", + safe_strerror (errno)); return -1; } @@ -307,7 +317,8 @@ sockunion_log (union sockunion *su) #ifdef HAVE_IPV6 case AF_INET6: snprintf (buf, SU_ADDRSTRLEN, "%s", - inet_ntop (AF_INET6, &(su->sin6.sin6_addr), buf, SU_ADDRSTRLEN)); + inet_ntop (AF_INET6, &(su->sin6.sin6_addr), buf, + SU_ADDRSTRLEN)); break; #endif /* HAVE_IPV6 */ default: @@ -459,7 +470,8 @@ sockopt_reuseaddr (int sock) (void *) &on, sizeof (on)); if (ret < 0) { - zlog (NULL, LOG_WARNING, "can't set sockopt SO_REUSEADDR to socket %d", sock); + zlog (NULL, LOG_WARNING, "can't set sockopt SO_REUSEADDR to socket %d", + sock); return -1; } return 0; @@ -476,7 +488,8 @@ sockopt_reuseport (int sock) (void *) &on, sizeof (on)); if (ret < 0) { - zlog (NULL, LOG_WARNING, "can't set sockopt SO_REUSEPORT to socket %d", sock); + zlog (NULL, LOG_WARNING, "can't set sockopt SO_REUSEPORT to socket %d", + sock); return -1; } return 0; @@ -501,7 +514,8 @@ sockopt_ttl (int family, int sock, int t (void *) &ttl, sizeof (int)); if (ret < 0) { - zlog (NULL, LOG_WARNING, "can't set sockopt IP_TTL %d to socket %d", ttl, sock); + zlog (NULL, LOG_WARNING, "can't set sockopt IP_TTL %d to socket %d", + ttl, sock); return -1; } return 0; @@ -514,8 +528,9 @@ sockopt_ttl (int family, int sock, int t (void *) &ttl, sizeof (int)); if (ret < 0) { - zlog (NULL, LOG_WARNING, "can't set sockopt IPV6_UNICAST_HOPS %d to socket %d", - ttl, sock); + zlog (NULL, LOG_WARNING, + "can't set sockopt IPV6_UNICAST_HOPS %d to socket %d", ttl, + sock); return -1; } return 0; @@ -662,8 +677,7 @@ sockunion_getpeername (int fd) } /* Print sockunion structure */ -static void __attribute__ ((unused)) -sockunion_print (union sockunion *su) +static void __attribute__ ((unused)) sockunion_print (union sockunion *su) { if (su == NULL) return; @@ -731,7 +745,8 @@ sockunion_cmp (union sockunion *su1, uni if (su1->sa.sa_family == AF_INET) { - if (ntohl (su1->sin.sin_addr.s_addr) == ntohl (su2->sin.sin_addr.s_addr)) + if (ntohl (su1->sin.sin_addr.s_addr) == + ntohl (su2->sin.sin_addr.s_addr)) return 0; if (ntohl (su1->sin.sin_addr.s_addr) > ntohl (su2->sin.sin_addr.s_addr)) return 1; --- quagga-0.99.9/lib/sockunion.h 2005-05-03 12:14:13.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/sockunion.h 2008-04-16 11:55:47.000000000 -0700 @@ -24,8 +24,10 @@ #define _ZEBRA_SOCKUNION_H #if 0 -union sockunion { - struct sockinet { +union sockunion +{ + struct sockinet + { u_char si_len; u_char si_family; u_short si_port; --- quagga-0.99.9/lib/str.c 2005-09-19 06:12:02.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/str.c 2008-04-16 11:55:47.000000000 -0700 @@ -49,7 +49,8 @@ strlcpy(char *d, const char *s, size_t b { size_t len = strlen(s); size_t ret = len; - if (bufsize > 0) { + if (bufsize > 0) + { if (len >= bufsize) len = bufsize-1; memcpy(d, s, len); @@ -74,7 +75,8 @@ strlcat(char *d, const char *s, size_t b size_t len2 = strlen(s); size_t ret = len1 + len2; - if (len1 < bufsize - 1) { + if (len1 < bufsize - 1) + { if (len2 >= bufsize - len1) len2 = bufsize - len1 - 1; memcpy(d+len1, s, len2); @@ -89,7 +91,9 @@ size_t strnlen(const char *s, size_t maxlen) { const char *p; - return (p = (const char *)memchr(s, '\0', maxlen)) ? (size_t)(p-s) : maxlen; + return (p = + (const char *) memchr (s, '\0', + maxlen)) ? (size_t) (p - s) : maxlen; } #endif --- quagga-0.99.9/lib/stream.c 2006-02-03 06:47:24.000000000 -0800 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/stream.c 2008-04-16 11:55:47.000000000 -0700 @@ -760,7 +760,8 @@ stream_read_try(struct stream *s, int fd /* Error: was it transient (return -2) or fatal (return -1)? */ if (ERRNO_IO_RETRY(errno)) return -2; - zlog_warn("%s: read failed on fd %d: %s", __func__, fd, safe_strerror(errno)); + zlog_warn ("%s: read failed on fd %d: %s", __func__, fd, + safe_strerror (errno)); return -1; } @@ -792,7 +793,8 @@ stream_recvfrom (struct stream *s, int f /* Error: was it transient (return -2) or fatal (return -1)? */ if (ERRNO_IO_RETRY(errno)) return -2; - zlog_warn("%s: read failed on fd %d: %s", __func__, fd, safe_strerror(errno)); + zlog_warn ("%s: read failed on fd %d: %s", __func__, fd, + safe_strerror (errno)); return -1; } --- quagga-0.99.9/lib/table.c 2005-05-03 10:11:25.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/table.c 2008-04-16 11:55:47.000000000 -0700 @@ -125,8 +125,7 @@ route_table_free (struct route_table *rt } /* Utility mask array. */ -static u_char maskbit[] = -{ +static u_char maskbit[] = { 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff }; @@ -220,8 +219,7 @@ route_unlock_node (struct route_node *no } /* Dump routing table. */ -static void __attribute__ ((unused)) -route_dump_node (struct route_table *t) +static void __attribute__ ((unused)) route_dump_node (struct route_table *t) { struct route_node *node; char buf[46]; --- quagga-0.99.9/lib/thread.c 2006-08-26 23:40:36.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/thread.c 2008-04-16 11:55:47.000000000 -0700 @@ -30,6 +30,8 @@ #include "command.h" #include "sigevent.h" + + /* Recent absolute time of day */ struct timeval recent_time; static struct timeval last_recent_time; @@ -82,8 +84,7 @@ timeval_subtract (struct timeval a, stru static long timeval_cmp (struct timeval a, struct timeval b) { - return (a.tv_sec == b.tv_sec - ? a.tv_usec - b.tv_usec : a.tv_sec - b.tv_sec); + return (a.tv_sec == b.tv_sec ? a.tv_usec - b.tv_usec : a.tv_sec - b.tv_sec); } static unsigned long @@ -240,8 +241,7 @@ cpu_record_hash_alloc (struct cpu_thread } static inline void -vty_out_cpu_thread_history(struct vty* vty, - struct cpu_thread_history *a) +vty_out_cpu_thread_history (struct vty *vty, struct cpu_thread_history *a) { #ifdef HAVE_RUSAGE vty_out(vty, "%7ld.%03ld %9d %8ld %9ld %8ld %9ld", @@ -264,8 +264,7 @@ vty_out_cpu_thread_history(struct vty* v } static void -cpu_record_hash_print(struct hash_backet *bucket, - void *args[]) +cpu_record_hash_print (struct hash_backet *bucket, void *args[]) { struct cpu_thread_history *totals = args[0]; struct vty *vty = args[1]; @@ -307,8 +306,8 @@ cpu_record_print(struct vty *vty, unsign #endif vty_out(vty, " Type Thread%s", VTY_NEWLINE); hash_iterate(cpu_record, - (void(*)(struct hash_backet*,void*))cpu_record_hash_print, - args); + (void (*)(struct hash_backet *, void *)) + cpu_record_hash_print, args); if (tmp.total_calls > 0) vty_out_cpu_thread_history(vty, &tmp); @@ -319,8 +318,7 @@ DEFUN(show_thread_cpu, "show thread cpu [FILTER]", SHOW_STR "Thread information\n" - "Thread CPU usage\n" - "Display filter (rwtexb)\n") + "Thread CPU usage\n" "Display filter (rwtexb)\n") { int i = 0; unsigned char filter = 0xff; @@ -409,7 +407,8 @@ thread_master_create () { if (cpu_record == NULL) cpu_record - = hash_create_size (1011, (unsigned int (*) (void *))cpu_record_hash_key, + = + hash_create_size (1011, (unsigned int (*)(void *)) cpu_record_hash_key, (int (*) (void *, void *))cpu_record_hash_cmp); return (struct thread_master *) XCALLOC (MTYPE_THREAD_MASTER, @@ -433,8 +432,7 @@ thread_list_add (struct thread_list *lis /* Add a new thread just before the point. */ static void thread_list_add_before (struct thread_list *list, - struct thread *point, - struct thread *thread) + struct thread *point, struct thread *thread) { thread->next = point; thread->prev = point->prev; @@ -594,7 +592,8 @@ thread_get (struct thread_master *m, u_c /* Add new read thread. */ struct thread * funcname_thread_add_read (struct thread_master *m, - int (*func) (struct thread *), void *arg, int fd, const char* funcname) + int (*func) (struct thread *), void *arg, int fd, + const char *funcname) { struct thread *thread; @@ -617,7 +616,8 @@ funcname_thread_add_read (struct thread_ /* Add new write thread. */ struct thread * funcname_thread_add_write (struct thread_master *m, - int (*func) (struct thread *), void *arg, int fd, const char* funcname) + int (*func) (struct thread *), void *arg, int fd, + const char *funcname) { struct thread *thread; @@ -716,8 +717,7 @@ funcname_thread_add_timer_msec (struct t struct thread * funcname_thread_add_background (struct thread_master *m, int (*func) (struct thread *), - void *arg, long delay, - const char *funcname) + void *arg, long delay, const char *funcname) { struct timeval trel; @@ -741,7 +741,8 @@ funcname_thread_add_background (struct t /* Add simple event thread. */ struct thread * funcname_thread_add_event (struct thread_master *m, - int (*func) (struct thread *), void *arg, int val, const char* funcname) + int (*func) (struct thread *), void *arg, int val, + const char *funcname) { struct thread *thread; @@ -973,7 +975,8 @@ thread_fetch (struct thread_master *m, s } unsigned long -thread_consumed_time (RUSAGE_T *now, RUSAGE_T *start, unsigned long *cputime) +thread_consumed_time (RUSAGE_T * now, RUSAGE_T * start, + unsigned long *cputime) { #ifdef HAVE_RUSAGE /* This is 'user + sys' time. */ @@ -1085,9 +1088,7 @@ thread_call (struct thread *thread) struct thread * funcname_thread_execute (struct thread_master *m, int (*func)(struct thread *), - void *arg, - int val, - const char* funcname) + void *arg, int val, const char *funcname) { struct thread dummy; --- quagga-0.99.9/lib/thread.h 2006-08-26 23:40:36.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/thread.h 2008-04-16 11:55:47.000000000 -0700 @@ -67,7 +67,8 @@ struct thread struct thread_master *master; /* pointer to the struct thread_master. */ int (*func) (struct thread *); /* event function */ void *arg; /* event argument */ - union { + union + { int val; /* second argument of the event. */ int fd; /* file descriptor in case of read/write. */ struct timeval sands; /* rest of time sands value. */ @@ -93,7 +94,8 @@ struct cpu_thread_history }; /* Clocks supported by Quagga */ -enum quagga_clkid { +enum quagga_clkid +{ QUAGGA_CLK_REALTIME = 0, /* ala gettimeofday() */ QUAGGA_CLK_MONOTONIC, /* monotonic, against an indeterminate base */ QUAGGA_CLK_REALTIME_STABILISED, /* like realtime, but non-decrementing */ @@ -172,15 +174,18 @@ extern struct thread *funcname_thread_ad int (*)(struct thread *), void *, long, const char*); extern struct thread *funcname_thread_add_timer_msec (struct thread_master *, - int (*)(struct thread *), - void *, long, const char*); + int (*)(struct thread + *), void *, + long, const char *); extern struct thread *funcname_thread_add_event (struct thread_master *, int (*)(struct thread *), void *, int, const char*); extern struct thread *funcname_thread_add_background (struct thread_master *, - int (*func)(struct thread *), + int (*func) (struct + thread *), void *arg, - long milliseconds_to_delay, + long + milliseconds_to_delay, const char *funcname); extern struct thread *funcname_thread_execute (struct thread_master *, int (*)(struct thread *), @@ -204,7 +209,8 @@ extern int quagga_gettime (enum quagga_c extern time_t quagga_time (time_t *); /* Returns elapsed real (wall clock) time. */ -extern unsigned long thread_consumed_time(RUSAGE_T *after, RUSAGE_T *before, +extern unsigned long thread_consumed_time (RUSAGE_T * after, + RUSAGE_T * before, unsigned long *cpu_time_elapsed); /* Global variable containing a recent result from gettimeofday. This can --- quagga-0.99.9/lib/vty.c 2007-05-09 13:59:34.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/vty.c 2008-04-16 11:55:47.000000000 -0700 @@ -157,7 +157,8 @@ vty_log_out (struct vty *vty, const char if (!ctl->already_rendered) { - ctl->len = quagga_timestamp(ctl->precision, ctl->buf, sizeof(ctl->buf)); + ctl->len = + quagga_timestamp (ctl->precision, ctl->buf, sizeof (ctl->buf)); ctl->already_rendered = 1; } if (ctl->len+1 >= sizeof(buf)) @@ -167,7 +168,8 @@ vty_log_out (struct vty *vty, const char buf[len] = '\0'; if (level) - ret = snprintf(buf+len, sizeof(buf)-len, "%s: %s: ", level, proto_str); + ret = + snprintf (buf + len, sizeof (buf) - len, "%s: %s: ", level, proto_str); else ret = snprintf(buf+len, sizeof(buf)-len, "%s: ", proto_str); if ((ret < 0) || ((size_t)(len += ret) >= sizeof(buf))) @@ -235,8 +237,8 @@ vty_hello (struct vty *vty) { char *s; /* work backwards to ignore trailling isspace() */ - for (s = buf + strlen (buf); (s > buf) && isspace ((int)*(s - 1)); - s--); + for (s = buf + strlen (buf); + (s > buf) && isspace ((int) *(s - 1)); s--); *s = '\0'; vty_out (vty, "%s%s", buf, VTY_NEWLINE); } @@ -375,14 +377,16 @@ vty_auth (struct vty *vty, char *buf) { if (vty->node == AUTH_NODE) { - vty_out (vty, "%% Bad passwords, too many failures!%s", VTY_NEWLINE); + vty_out (vty, "%% Bad passwords, too many failures!%s", + VTY_NEWLINE); vty->status = VTY_CLOSE; } else { /* AUTH_ENABLE_NODE */ vty->fail = 0; - vty_out (vty, "%% Bad enable passwords, too many failures!%s", VTY_NEWLINE); + vty_out (vty, "%% Bad enable passwords, too many failures!%s", + VTY_NEWLINE); vty->node = VIEW_NODE; } } @@ -441,7 +445,8 @@ vty_command (struct vty *vty, char *buf) vty_out (vty, "%% Ambiguous command.%s", VTY_NEWLINE); break; case CMD_ERR_NO_MATCH: - vty_out (vty, "%% [%s] Unknown command: %s%s", protocolname, buf, VTY_NEWLINE); + vty_out (vty, "%% [%s] Unknown command: %s%s", protocolname, buf, + VTY_NEWLINE); break; case CMD_ERR_INCOMPLETE: vty_out (vty, "%% Command incomplete.%s", VTY_NEWLINE); @@ -980,8 +985,7 @@ vty_describe_command (struct vty *vty) vline = vector_init (1); vector_set (vline, '\0'); } - else - if (isspace ((int) vty->buf[vty->length - 1])) + else if (isspace ((int) vty->buf[vty->length - 1])) vector_set (vline, '\0'); describe = cmd_describe_command (vline, vty, &ret); @@ -1240,9 +1244,10 @@ vty_telnet_option (struct vty *vty, unsi vty->width = ((vty->sb_buf[1] << 8)|vty->sb_buf[2]); vty->height = ((vty->sb_buf[3] << 8)|vty->sb_buf[4]); #ifdef TELNET_OPTION_DEBUG - vty_out(vty, "TELNET NAWS window size negotiation completed: " - "width %d, height %d%s", - vty->width, vty->height, VTY_NEWLINE); + vty_out (vty, + "TELNET NAWS window size negotiation completed: " + "width %d, height %d%s", vty->width, vty->height, + VTY_NEWLINE); #endif } break; @@ -1568,14 +1573,12 @@ vty_flush (struct thread *thread) else flushrc = buffer_flush_window(vty->obuf, vty->fd, vty->width, vty->lines >= 0 ? vty->lines : - vty->height, - erase, 0); + vty->height, erase, 0); switch (flushrc) { case BUFFER_ERROR: vty->monitor = 0; /* disable monitoring to avoid infinite recursion */ - zlog_warn("buffer_flush failed on vty client fd %d, closing", - vty->fd); + zlog_warn ("buffer_flush failed on vty client fd %d, closing", vty->fd); buffer_reset(vty->obuf); vty_close(vty); return 0; @@ -1653,7 +1656,8 @@ vty_create (int vty_sock, union sockunio /* Say hello to the world. */ vty_hello (vty); if (! no_password_check) - vty_out (vty, "%sUser Access Verification%s%s", VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); + vty_out (vty, "%sUser Access Verification%s%s", VTY_NEWLINE, VTY_NEWLINE, + VTY_NEWLINE); /* Setting up terminal. */ vty_will_echo (vty); @@ -1798,7 +1802,8 @@ vty_serv_sock_addrinfo (const char *host ) continue; - sock = socket (ainfo->ai_family, ainfo->ai_socktype, ainfo->ai_protocol); + sock = + socket (ainfo->ai_family, ainfo->ai_socktype, ainfo->ai_protocol); if (sock < 0) continue; @@ -1857,7 +1862,8 @@ vty_serv_sock_family (const char* addr, naddr=NULL; break; case 0: - zlog_err("error translating address %s: %s",addr,safe_strerror(errno)); + zlog_err ("error translating address %s: %s", addr, + safe_strerror (errno)); naddr=NULL; } @@ -1916,7 +1922,8 @@ vty_serv_un (const char *path) sock = socket (AF_UNIX, SOCK_STREAM, 0); if (sock < 0) { - zlog_err("Cannot create unix stream socket: %s", safe_strerror(errno)); + zlog_err ("Cannot create unix stream socket: %s", + safe_strerror (errno)); return; } @@ -2310,8 +2317,7 @@ vty_use_backup_config (char *fullpath) /* Read up configuration file from file_name. */ void -vty_read_config (char *config_file, - char *config_default_dir) +vty_read_config (char *config_file, char *config_default_dir) { char cwd[MAXPATHLEN]; FILE *confp = NULL; @@ -2324,8 +2330,7 @@ vty_read_config (char *config_file, if (! IS_DIRECTORY_SEP (config_file[0])) { getcwd (cwd, MAXPATHLEN); - tmp = XMALLOC (MTYPE_TMP, - strlen (cwd) + strlen (config_file) + 2); + tmp = XMALLOC (MTYPE_TMP, strlen (cwd) + strlen (config_file) + 2); sprintf (tmp, "%s/%s", cwd, config_file); fullpath = tmp; } @@ -2537,10 +2542,7 @@ vty_event (enum event event, int sock, s } } -DEFUN (config_who, - config_who_cmd, - "who", - "Display who is on vty\n") +DEFUN (config_who, config_who_cmd, "who", "Display who is on vty\n") { unsigned int i; struct vty *v; @@ -2548,17 +2550,14 @@ DEFUN (config_who, for (i = 0; i < vector_active (vtyvec); i++) if ((v = vector_slot (vtyvec, i)) != NULL) vty_out (vty, "%svty[%d] connected from %s.%s", - v->config ? "*" : " ", - i, v->address, VTY_NEWLINE); + v->config ? "*" : " ", i, v->address, VTY_NEWLINE); return CMD_SUCCESS; } /* Move to vty configuration mode. */ DEFUN (line_vty, line_vty_cmd, - "line vty", - "Configure a terminal line\n" - "Virtual terminal\n") + "line vty", "Configure a terminal line\n" "Virtual terminal\n") { vty->node = VTY_NODE; return CMD_SUCCESS; @@ -2591,8 +2590,7 @@ exec_timeout (struct vty *vty, const cha DEFUN (exec_timeout_min, exec_timeout_min_cmd, "exec-timeout <0-35791>", - "Set timeout value\n" - "Timeout value in minutes\n") + "Set timeout value\n" "Timeout value in minutes\n") { return exec_timeout (vty, argv[0], NULL); } @@ -2600,18 +2598,14 @@ DEFUN (exec_timeout_min, DEFUN (exec_timeout_sec, exec_timeout_sec_cmd, "exec-timeout <0-35791> <0-2147483>", - "Set the EXEC timeout\n" - "Timeout in minutes\n" - "Timeout in seconds\n") + "Set the EXEC timeout\n" "Timeout in minutes\n" "Timeout in seconds\n") { return exec_timeout (vty, argv[0], argv[1]); } DEFUN (no_exec_timeout, no_exec_timeout_cmd, - "no exec-timeout", - NO_STR - "Set the EXEC timeout\n") + "no exec-timeout", NO_STR "Set the EXEC timeout\n") { return exec_timeout (vty, NULL, NULL); } @@ -2620,8 +2614,7 @@ DEFUN (no_exec_timeout, DEFUN (vty_access_class, vty_access_class_cmd, "access-class WORD", - "Filter connections based on an IP access list\n" - "IP access list\n") + "Filter connections based on an IP access list\n" "IP access list\n") { if (vty_accesslist_name) XFREE(MTYPE_VTY, vty_accesslist_name); @@ -2636,8 +2629,7 @@ DEFUN (no_vty_access_class, no_vty_access_class_cmd, "no access-class [WORD]", NO_STR - "Filter connections based on an IP access list\n" - "IP access list\n") + "Filter connections based on an IP access list\n" "IP access list\n") { if (! vty_accesslist_name || (argc && strcmp(vty_accesslist_name, argv[0]))) { @@ -2659,8 +2651,7 @@ DEFUN (vty_ipv6_access_class, vty_ipv6_access_class_cmd, "ipv6 access-class WORD", IPV6_STR - "Filter connections based on an IP access list\n" - "IPv6 access list\n") + "Filter connections based on an IP access list\n" "IPv6 access list\n") { if (vty_ipv6_accesslist_name) XFREE(MTYPE_VTY, vty_ipv6_accesslist_name); @@ -2676,8 +2667,7 @@ DEFUN (no_vty_ipv6_access_class, "no ipv6 access-class [WORD]", NO_STR IPV6_STR - "Filter connections based on an IP access list\n" - "IPv6 access list\n") + "Filter connections based on an IP access list\n" "IPv6 access list\n") { if (! vty_ipv6_accesslist_name || (argc && strcmp(vty_ipv6_accesslist_name, argv[0]))) @@ -2696,20 +2686,14 @@ DEFUN (no_vty_ipv6_access_class, #endif /* HAVE_IPV6 */ /* vty login. */ -DEFUN (vty_login, - vty_login_cmd, - "login", - "Enable password checking\n") +DEFUN (vty_login, vty_login_cmd, "login", "Enable password checking\n") { no_password_check = 0; return CMD_SUCCESS; } DEFUN (no_vty_login, - no_vty_login_cmd, - "no login", - NO_STR - "Enable password checking\n") + no_vty_login_cmd, "no login", NO_STR "Enable password checking\n") { no_password_check = 1; return CMD_SUCCESS; @@ -2750,8 +2734,7 @@ DEFUN (terminal_no_monitor, terminal_no_monitor_cmd, "terminal no monitor", "Set terminal line parameters\n" - NO_STR - "Copy debug output to the current terminal line\n") + NO_STR "Copy debug output to the current terminal line\n") { vty->monitor = 0; return CMD_SUCCESS; @@ -2763,12 +2746,9 @@ ALIAS (terminal_no_monitor, NO_STR "Set terminal line parameters\n" "Copy debug output to the current terminal line\n") - DEFUN (show_history, show_history_cmd, - "show history", - SHOW_STR - "Display the session command history\n") + "show history", SHOW_STR "Display the session command history\n") { int index; @@ -2796,8 +2776,7 @@ vty_config_write (struct vty *vty) vty_out (vty, "line vty%s", VTY_NEWLINE); if (vty_accesslist_name) - vty_out (vty, " access-class %s%s", - vty_accesslist_name, VTY_NEWLINE); + vty_out (vty, " access-class %s%s", vty_accesslist_name, VTY_NEWLINE); if (vty_ipv6_accesslist_name) vty_out (vty, " ipv6 access-class %s%s", @@ -2806,8 +2785,7 @@ vty_config_write (struct vty *vty) /* exec-timeout */ if (vty_timeout_val != VTY_TIMEOUT_DEFAULT) vty_out (vty, " exec-timeout %ld %ld%s", - vty_timeout_val / 60, - vty_timeout_val % 60, VTY_NEWLINE); + vty_timeout_val / 60, vty_timeout_val % 60, VTY_NEWLINE); /* login */ if (no_password_check) @@ -2818,8 +2796,7 @@ vty_config_write (struct vty *vty) return CMD_SUCCESS; } -struct cmd_node vty_node = -{ +struct cmd_node vty_node = { VTY_NODE, "%s(config-line)# ", 1, --- quagga-0.99.9/lib/vty.h 2007-04-29 05:40:40.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/vty.h 2008-04-16 11:55:47.000000000 -0700 @@ -34,7 +35,8 @@ struct vty int fd; /* Is this vty connect to file or not */ - enum {VTY_TERM, VTY_FILE, VTY_SHELL, VTY_SHELL_SERV} type; + enum + { VTY_TERM, VTY_FILE, VTY_SHELL, VTY_SHELL_SERV } type; /* Node status of this vty */ int node; @@ -80,7 +82,8 @@ struct vty unsigned char escape; /* Current vty status. */ - enum {VTY_NORMAL, VTY_CLOSE, VTY_MORE, VTY_MORELINE} status; + enum + { VTY_NORMAL, VTY_CLOSE, VTY_MORE, VTY_MORELINE } status; /* IAC handling: was the last character received the IAC (interpret-as-command) escape character (and therefore the next @@ -205,14 +208,17 @@ extern void vty_init (struct thread_mast extern void vty_init_vtysh (void); extern void vty_reset (void); extern struct vty *vty_new (void); -extern int vty_out (struct vty *, const char *, ...) PRINTF_ATTRIBUTE(2, 3); +extern int +vty_out (struct vty *, const char *, ...) +PRINTF_ATTRIBUTE (2, 3); extern void vty_read_config (char *, char *); extern void vty_time_print (struct vty *, int); extern void vty_serv_sock (const char *, unsigned short, const char *); extern void vty_close (struct vty *); extern char *vty_get_cwd (void); extern void vty_log (const char *level, const char *proto, - const char *fmt, struct timestamp_control *, va_list); + const char *fmt, struct timestamp_control *, + va_list); extern int vty_config_lock (struct vty *); extern int vty_config_unlock (struct vty *); extern int vty_shell (struct vty *); --- quagga-0.99.9/lib/workqueue.c 2006-03-30 06:43:49.000000000 -0800 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/workqueue.c 2008-04-16 11:55:47.000000000 -0700 @@ -40,8 +40,7 @@ work_queue_item_new (struct work_queue * struct work_queue_item *item; assert (wq); - item = XCALLOC (MTYPE_WORK_QUEUE_ITEM, - sizeof (struct work_queue_item)); + item = XCALLOC (MTYPE_WORK_QUEUE_ITEM, sizeof (struct work_queue_item)); return item; } @@ -104,8 +103,7 @@ work_queue_schedule (struct work_queue * { /* if appropriate, schedule work queue thread */ if ( (wq->flags == WQ_UNPLUGGED) - && (wq->thread == NULL) - && (listcount (wq->items) > 0) ) + && (wq->thread == NULL) && (listcount (wq->items) > 0)) { wq->thread = thread_add_background (wq->master, work_queue_run, wq, delay); @@ -162,26 +160,19 @@ work_queue_item_requeue (struct work_que DEFUN(show_work_queues, show_work_queues_cmd, - "show work-queues", - SHOW_STR - "Work Queue information\n") + "show work-queues", SHOW_STR "Work Queue information\n") { struct listnode *node; struct work_queue *wq; vty_out (vty, "%c %8s %5s %8s %21s%s", - ' ', "List","(ms) ","Q. Runs","Cycle Counts ", - VTY_NEWLINE); + ' ', "List", "(ms) ", "Q. Runs", "Cycle Counts ", VTY_NEWLINE); vty_out (vty, "%c %8s %5s %8s %7s %6s %6s %s%s", 'P', "Items", - "Hold", - "Total", - "Best","Gran.","Avg.", - "Name", - VTY_NEWLINE); + "Hold", "Total", "Best", "Gran.", "Avg.", "Name", VTY_NEWLINE); for (ALL_LIST_ELEMENTS_RO ((&work_queues), node, wq)) { @@ -193,8 +184,7 @@ DEFUN(show_work_queues, wq->cycles.best, wq->cycles.granularity, (wq->runs) ? (unsigned int) (wq->cycles.total / wq->runs) : 0, - wq->name, - VTY_NEWLINE); + wq->name, VTY_NEWLINE); } return CMD_SUCCESS; @@ -285,8 +275,7 @@ work_queue_run (struct thread *thread) ret = wq->spec.workfunc (wq, item->data); item->ran++; } - while ((ret == WQ_RETRY_NOW) - && (item->ran < wq->spec.max_retries)); + while ((ret == WQ_RETRY_NOW) && (item->ran < wq->spec.max_retries)); switch (ret) { @@ -326,8 +315,7 @@ work_queue_run (struct thread *thread) cycles++; /* test if we should yield */ - if ( !(cycles % wq->cycles.granularity) - && thread_should_yield (thread)) + if (!(cycles % wq->cycles.granularity) && thread_should_yield (thread)) { yielded = 1; goto stats; --- quagga-0.99.9/lib/workqueue.h 2006-03-30 06:20:39.000000000 -0800 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/workqueue.h 2008-04-16 11:55:47.000000000 -0700 @@ -65,7 +65,8 @@ struct work_queue /* Specification for this work queue. * Public, must be set before use by caller. May be modified at will. */ - struct { + struct + { /* optional opaque user data, global to the queue. */ void *data; @@ -94,7 +95,8 @@ struct work_queue struct list *items; /* queue item list */ unsigned long runs; /* runs count */ - struct { + struct + { unsigned int best; unsigned int granularity; unsigned long total; --- quagga-0.99.9/lib/zclient.c 2007-05-09 13:59:34.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/zclient.c 2008-04-16 11:55:47.000000000 -0700 @@ -34,7 +34,8 @@ #include "table.h" /* Zebra client events. */ -enum event {ZCLIENT_SCHEDULE, ZCLIENT_READ, ZCLIENT_CONNECT}; +enum event +{ ZCLIENT_SCHEDULE, ZCLIENT_READ, ZCLIENT_CONNECT }; /* Prototype for event manager. */ static void zclient_event (enum event, struct zclient *); @@ -232,7 +233,8 @@ zclient_flush_data(struct thread *thread switch (buffer_flush_available(zclient->wb, zclient->sock)) { case BUFFER_ERROR: - zlog_warn("%s: buffer_flush_available failed on zclient fd %d, closing", + zlog_warn + ("%s: buffer_flush_available failed on zclient fd %d, closing", __func__, zclient->sock); return zclient_failed(zclient); break; @@ -251,7 +253,8 @@ zclient_send_message(struct zclient *zcl { if (zclient->sock < 0) return -1; - switch (buffer_write(zclient->wb, zclient->sock, STREAM_DATA(zclient->obuf), + switch (buffer_write + (zclient->wb, zclient->sock, STREAM_DATA (zclient->obuf), stream_get_endp(zclient->obuf))) { case BUFFER_ERROR: @@ -613,7 +616,8 @@ zebra_interface_add_read (struct stream stream_get (ifname_tmp, s, INTERFACE_NAMSIZ); /* Lookup/create interface by name. */ - ifp = if_get_by_name_len (ifname_tmp, strnlen(ifname_tmp, INTERFACE_NAMSIZ)); + ifp = + if_get_by_name_len (ifname_tmp, strnlen (ifname_tmp, INTERFACE_NAMSIZ)); /* Read interface's index. */ ifp->ifindex = stream_getl (s); @@ -777,8 +781,10 @@ zebra_interface_address_read (int type, if (type == ZEBRA_INTERFACE_ADDRESS_ADD) { /* N.B. NULL destination pointers are encoded as all zeroes */ - ifc = connected_add_by_prefix(ifp, &p,(memconstant(&d.u.prefix,0,plen) ? - NULL : &d)); + ifc = + connected_add_by_prefix (ifp, &p, + (memconstant (&d.u.prefix, 0, plen) ? NULL : + &d)); if (ifc != NULL) { ifc->flags = ifc_flags; @@ -819,7 +825,8 @@ zclient_read (struct thread *thread) (nbyte == -1)) { if (zclient_debug) - zlog_debug ("zclient connection closed socket [%d].", zclient->sock); + zlog_debug ("zclient connection closed socket [%d].", + zclient->sock); return zclient_failed(zclient); } if (nbyte != (ssize_t)(ZEBRA_HEADER_SIZE-already)) @@ -875,7 +882,8 @@ zclient_read (struct thread *thread) (nbyte == -1)) { if (zclient_debug) - zlog_debug("zclient connection closed socket [%d].", zclient->sock); + zlog_debug ("zclient connection closed socket [%d].", + zclient->sock); return zclient_failed(zclient); } if (nbyte != (ssize_t)(length-already)) --- quagga-0.99.9/lib/zclient.h 2006-01-31 12:55:54.000000000 -0800 +++ quagga-0.99.9.ospfv3-extensions.tmp/lib/zclient.h 2008-04-16 11:55:47.000000000 -0700 @@ -151,8 +151,10 @@ extern void zclient_create_header (struc extern struct interface *zebra_interface_add_read (struct stream *); extern struct interface *zebra_interface_state_read (struct stream *s); extern struct connected *zebra_interface_address_read (int, struct stream *); -extern void zebra_interface_if_set_value (struct stream *, struct interface *); -extern void zebra_router_id_update_read (struct stream *s, struct prefix *rid); +extern void zebra_interface_if_set_value (struct stream *, + struct interface *); +extern void zebra_router_id_update_read (struct stream *s, + struct prefix *rid); extern int zapi_ipv4_route (u_char, struct zclient *, struct prefix_ipv4 *, struct zapi_ipv4 *); --- quagga-0.99.9/ospf6d/ospf6_abr.c 2006-05-15 03:43:52.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_abr.c 2008-04-16 11:55:47.000000000 -0700 @@ -206,7 +207,8 @@ ospf6_abr_originate_summary_to_area (str ! CHECK_FLAG (route->path.router_bits, OSPF6_ROUTER_BIT_E))) { if (is_debug) - zlog_debug ("Route type is none of network, range nor ASBR, withdraw"); + zlog_debug + ("Route type is none of network, range nor ASBR, withdraw"); if (summary) ospf6_route_remove (summary, summary_table); if (old) @@ -346,8 +348,7 @@ ospf6_abr_originate_summary_to_area (str if (EXPORT_NAME (area)) { if (EXPORT_LIST (area) == NULL) - EXPORT_LIST (area) = - access_list_lookup (AFI_IP6, EXPORT_NAME (area)); + EXPORT_LIST (area) = access_list_lookup (AFI_IP6, EXPORT_NAME (area)); if (EXPORT_LIST (area)) if (access_list_apply (EXPORT_LIST (area), @@ -678,7 +679,8 @@ ospf6_abr_examin_summary (struct ospf6_l if (PREFIX_NAME_IN (oa)) { if (PREFIX_LIST_IN (oa) == NULL) - PREFIX_LIST_IN (oa) = prefix_list_lookup (AFI_IP6, PREFIX_NAME_IN (oa)); + PREFIX_LIST_IN (oa) = + prefix_list_lookup (AFI_IP6, PREFIX_NAME_IN (oa)); if (PREFIX_LIST_IN (oa)) if (prefix_list_apply (PREFIX_LIST_IN (oa), &prefix) != PREFIX_PERMIT) @@ -809,11 +811,7 @@ ospf6_inter_area_router_lsa_show (struct /* Debug commands */ DEFUN (debug_ospf6_abr, debug_ospf6_abr_cmd, - "debug ospf6 abr", - DEBUG_STR - OSPF6_STR - "Debug OSPFv3 ABR function\n" - ) + "debug ospf6 abr", DEBUG_STR OSPF6_STR "Debug OSPFv3 ABR function\n") { OSPF6_DEBUG_ABR_ON (); return CMD_SUCCESS; @@ -822,11 +820,7 @@ DEFUN (debug_ospf6_abr, DEFUN (no_debug_ospf6_abr, no_debug_ospf6_abr_cmd, "no debug ospf6 abr", - NO_STR - DEBUG_STR - OSPF6_STR - "Debug OSPFv3 ABR function\n" - ) + NO_STR DEBUG_STR OSPF6_STR "Debug OSPFv3 ABR function\n") { OSPF6_DEBUG_ABR_OFF (); return CMD_SUCCESS; @@ -849,15 +843,13 @@ install_element_ospf6_debug_abr () install_element (CONFIG_NODE, &no_debug_ospf6_abr_cmd); } -struct ospf6_lsa_handler inter_prefix_handler = -{ +struct ospf6_lsa_handler inter_prefix_handler = { OSPF6_LSTYPE_INTER_PREFIX, "Inter-Prefix", ospf6_inter_area_prefix_lsa_show }; -struct ospf6_lsa_handler inter_router_handler = -{ +struct ospf6_lsa_handler inter_router_handler = { OSPF6_LSTYPE_INTER_ROUTER, "Inter-Router", ospf6_inter_area_router_lsa_show --- quagga-0.99.9/ospf6d/ospf6_area.c 2006-05-15 03:43:52.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_area.c 2008-04-16 11:55:47.000000000 -0700 @@ -3,20 +3,19 @@ * * This file is part of GNU Zebra. * - * GNU Zebra is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any - * later version. + * GNU Zebra is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2, or (at your option) any later + * version. * - * GNU Zebra is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. + * GNU Zebra is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. * - * You should have received a copy of the GNU General Public License - * along with GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along with + * GNU Zebra; see the file COPYING. If not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include @@ -314,10 +315,7 @@ DEFUN (area_range, area_range_cmd, "area A.B.C.D range X:X::X:X/M", "OSPF area parameters\n" - OSPF6_AREA_ID_STR - "Configured address range\n" - "Specify IPv6 prefix\n" - ) + OSPF6_AREA_ID_STR "Configured address range\n" "Specify IPv6 prefix\n") { int ret; struct ospf6_area *oa; @@ -362,18 +358,13 @@ ALIAS (area_range, "area A.B.C.D range X:X::X:X/M (advertise|not-advertise)", "OSPF area parameters\n" OSPF6_AREA_ID_STR - "Configured address range\n" - "Specify IPv6 prefix\n" - ); + "Configured address range\n" "Specify IPv6 prefix\n"); DEFUN (no_area_range, no_area_range_cmd, "no area A.B.C.D range X:X::X:X/M", "OSPF area parameters\n" - OSPF6_AREA_ID_STR - "Configured address range\n" - "Specify IPv6 prefix\n" - ) + OSPF6_AREA_ID_STR "Configured address range\n" "Specify IPv6 prefix\n") { int ret; struct ospf6_area *oa; @@ -614,10 +603,7 @@ DEFUN (show_ipv6_ospf6_spf_tree, show_ipv6_ospf6_spf_tree_cmd, "show ipv6 ospf6 spf tree", SHOW_STR - IP6_STR - OSPF6_STR - "Shortest Path First caculation\n" - "Show SPF tree\n") + IP6_STR OSPF6_STR "Shortest Path First caculation\n" "Show SPF tree\n") { struct listnode *node; struct ospf6_area *oa; @@ -650,9 +636,7 @@ DEFUN (show_ipv6_ospf6_area_spf_tree, IP6_STR OSPF6_STR OSPF6_AREA_STR - OSPF6_AREA_ID_STR - "Shortest Path First caculation\n" - "Show SPF tree\n") + OSPF6_AREA_ID_STR "Shortest Path First caculation\n" "Show SPF tree\n") { u_int32_t area_id; struct ospf6_area *oa; @@ -745,6 +727,194 @@ DEFUN (show_ipv6_ospf6_simulate_spf_tree return CMD_SUCCESS; } +static int +ospf6_area_linklog_timestampstr (char *buf, size_t bufsize) +{ + struct timeval tv; + struct tm tm; + size_t len; + + if (gettimeofday (&tv, NULL)) + { + zlog_warn ("%s: gettimeofday() failed", __func__); + return -1; + } + if (gmtime_r (&tv.tv_sec, &tm) == NULL) + { + zlog_warn ("%s: gmtime_r() failed", __func__); + return -1; + } + if ((len = strftime (buf, bufsize, "%T", &tm)) == 0) + { + zlog_warn ("%s: timestampstr() failed", __func__); + return -1; + } + if (bufsize - len == 1) + { + zlog_warn ("%s: time stamp string exceeds bufsize", __func__); + return -1; + } + buf += len; + bufsize -= len; + if (snprintf (buf, bufsize, ".%06d", tv.tv_usec) >= bufsize) + { + zlog_warn ("%s: snprintf() failed", __func__); + return -1; + } + return 0; +} + +static int +ospf6_area_linklog (struct ospf6_area *area) +{ + char timestr[16]; + u_int16_t type; + struct ospf6_lsa *lsa; + + if (!area->linklog_stream) + { + zlog_warn ("%s: no linklog output file", __func__); + return -1; + } + if (ospf6_area_linklog_timestampstr (timestr, sizeof (timestr))) + return -1; + + fprintf (area->linklog_stream, "Routing-Links List: %s\n", timestr); + + type = ntohs (OSPF6_LSTYPE_ROUTER); + for (lsa = ospf6_lsdb_type_head (type, area->lsdb); + lsa; lsa = ospf6_lsdb_type_next (type, lsa)) + { + char *start, *end, *current; + struct ospf6_router_lsa *router_lsa; + char adv_router[64]; + + inet_ntop (AF_INET, &lsa->header->adv_router, + adv_router, sizeof (adv_router)); + + router_lsa = (struct ospf6_router_lsa *) + ((char *) lsa->header + sizeof (struct ospf6_lsa_header)); + start = (char *) router_lsa + sizeof (struct ospf6_router_lsa); + end = (char *) lsa->header + ntohs (lsa->header->length); + + for (current = start; + current + sizeof (struct ospf6_router_lsdesc) <= end; + current += sizeof (struct ospf6_router_lsdesc)) + { + struct ospf6_router_lsdesc *lsdesc; + char neighbor_router[64]; + + lsdesc = (struct ospf6_router_lsdesc *) current; + + inet_ntop (AF_INET, &lsdesc->neighbor_router_id, + neighbor_router, sizeof (neighbor_router)); + + fprintf (area->linklog_stream, "%s -> %s\n", adv_router, + neighbor_router); + } + } + + fprintf (area->linklog_stream, "End of Routing-Links List.\n"); + fflush (area->linklog_stream); + + return 0; +} + +static int +ospf6_area_linklog_timer (struct thread *thread) +{ + struct ospf6_area *area; + struct listnode *i; + char timestr[16]; + + area = (struct ospf6_area *) THREAD_ARG (thread); + assert (area); + + ospf6_area_linklog (area); + + area->linklog_thread = thread_add_timer (master, ospf6_area_linklog_timer, + area, area->linklog_interval); + + return 0; +} + +static void +ospf6_area_start_linklog (struct ospf6_area *area) +{ + THREAD_TIMER_ON (master, area->linklog_thread, + ospf6_area_linklog_timer, area, 0); + return; +} + +static void +ospf6_area_stop_linklog (struct ospf6_area *area) +{ + if (area->linklog_thread) + THREAD_TIMER_OFF (area->linklog_thread); + area->linklog_interval = 0; + return; +} + +DEFUN (area_linklog_file, + area_linklog_file_cmd, + "area A.B.C.D linklog-file FILENAME", + "OSPFv6 area parameters\n" + OSPF6_AREA_ID_STR "filename to log links to\n" "filename\n") +{ + struct ospf6_area *area; + + OSPF6_CMD_AREA_GET (argv[0], area); + + if (area->linklog_stream) + fclose (area->linklog_stream); + + if ((area->linklog_stream = fopen (argv[1], "a")) == NULL) + { + vty_out (vty, "%s: fopen('%s') failed: %s%s", + __func__, argv[1], strerror (errno), VNL); + return CMD_SUCCESS; + } + if (area->linklog_interval && !area->linklog_thread) + ospf6_area_start_linklog (area); + + return CMD_SUCCESS; +} + +DEFUN (area_linklog_interval, + area_linklog_interval_cmd, + "area A.B.C.D linklog-interval <0-255>", + "OSPFv6 area parameters\n" + OSPF6_AREA_ID_STR "minimum time between logging links\n" "seconds\n") +{ + struct ospf6_area *area; + + OSPF6_CMD_AREA_GET (argv[0], area); + + area->linklog_interval = strtol (argv[1], NULL, 10); + + if (area->linklog_interval && area->linklog_stream && !area->linklog_thread) + ospf6_area_start_linklog (area); + else if (!area->linklog_interval && area->linklog_thread) + ospf6_area_stop_linklog (area); + + return CMD_SUCCESS; +} + +DEFUN (no_area_linklog, + no_area_linklog_cmd, + "no area A.B.C.D linklog", + NO_STR + "OSPF area parameters\n" OSPF6_AREA_ID_STR "disable logging links\n") +{ + struct ospf6_area *area; + + OSPF6_CMD_AREA_GET (argv[0], area); + + ospf6_area_stop_linklog (area); + + return CMD_SUCCESS; +} + void ospf6_area_init () { @@ -768,6 +938,8 @@ ospf6_area_init () install_element (OSPF6_NODE, &area_filter_list_cmd); install_element (OSPF6_NODE, &no_area_filter_list_cmd); -} - + install_element (OSPF6_NODE, &area_linklog_file_cmd); + install_element (OSPF6_NODE, &area_linklog_interval_cmd); + install_element (OSPF6_NODE, &no_area_linklog_cmd); +} --- quagga-0.99.9/ospf6d/ospf6_area.h 2005-06-27 16:55:57.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_area.h 2008-04-16 11:55:47.000000000 -0700 @@ -97,6 +98,10 @@ struct ospf6_area #define PREFIX_NAME_OUT(A) (A)->plist_out.name #define PREFIX_LIST_OUT(A) (A)->plist_out.list + u_char linklog_interval; + FILE *linklog_stream; + struct thread *linklog_thread; + }; #define OSPF6_AREA_ENABLE 0x01 @@ -126,5 +131,5 @@ void ospf6_area_show (struct vty *, stru void ospf6_area_config_write (struct vty *vty); void ospf6_area_init (); -#endif /* OSPF_AREA_H */ +#endif /* OSPF_AREA_H */ --- quagga-0.99.9/ospf6d/ospf6_asbr.c 2006-05-15 03:46:39.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_asbr.c 2008-04-16 11:55:47.000000000 -0700 @@ -325,14 +326,6 @@ ospf6_asbr_lsentry_remove (struct ospf6_ u_int16_t type; u_int32_t router; - if (! CHECK_FLAG (asbr_entry->flag, OSPF6_ROUTE_BEST)) - { - char buf[16]; - inet_ntop (AF_INET, &ADV_ROUTER_IN_PREFIX (&asbr_entry->prefix), - buf, sizeof (buf)); - zlog_info ("ignore non-best path: lsentry %s remove", buf); - return; - } type = htons (OSPF6_LSTYPE_AS_EXTERNAL); router = ospf6_linkstate_prefix_adv_router (&asbr_entry->prefix); @@ -487,7 +480,8 @@ ospf6_asbr_redistribute_add (int type, i info->type = type; match->nexthop[0].ifindex = ifindex; if (nexthop_num && nexthop) - memcpy (&match->nexthop[0].address, nexthop, sizeof (struct in6_addr)); + memcpy (&match->nexthop[0].address, nexthop, + sizeof (struct in6_addr)); /* create/update binding in external_id_table */ prefix_id.family = AF_INET; @@ -629,11 +623,7 @@ DEFUN (ospf6_redistribute, "redistribute (static|kernel|connected|ripng|bgp)", "Redistribute\n" "Static route\n" - "Kernel route\n" - "Connected route\n" - "RIPng route\n" - "BGP route\n" - ) + "Kernel route\n" "Connected route\n" "RIPng route\n" "BGP route\n") { int type = 0; @@ -662,10 +652,7 @@ DEFUN (ospf6_redistribute_routemap, "Kernel route\n" "Connected route\n" "RIPng route\n" - "BGP route\n" - "Route map reference\n" - "Route map name\n" - ) + "BGP route\n" "Route map reference\n" "Route map name\n") { int type = 0; @@ -692,11 +679,7 @@ DEFUN (no_ospf6_redistribute, NO_STR "Redistribute\n" "Static route\n" - "Kernel route\n" - "Connected route\n" - "RIPng route\n" - "BGP route\n" - ) + "Kernel route\n" "Connected route\n" "RIPng route\n" "BGP route\n") { int type = 0; @@ -733,8 +716,7 @@ ospf6_redistribute_config_write (struct vty_out (vty, " redistribute %s route-map %s%s", ZROUTE_NAME (type), ospf6->rmap[type].name, VNL); else - vty_out (vty, " redistribute %s%s", - ZROUTE_NAME (type), VNL); + vty_out (vty, " redistribute %s%s", ZROUTE_NAME (type), VNL); } return 0; @@ -771,11 +753,9 @@ ospf6_redistribute_show_config (struct v if (ospf6->rmap[type].name) vty_out (vty, " %d: %s with route-map \"%s\"%s%s", nroute[type], ZROUTE_NAME (type), ospf6->rmap[type].name, - (ospf6->rmap[type].map ? "" : " (not found !)"), - VNL); + (ospf6->rmap[type].map ? "" : " (not found !)"), VNL); else - vty_out (vty, " %d: %s%s", nroute[type], - ZROUTE_NAME (type), VNL); + vty_out (vty, " %d: %s%s", nroute[type], ZROUTE_NAME (type), VNL); } vty_out (vty, "Total %d routes%s", total, VNL); } @@ -814,9 +794,7 @@ ospf6_routemap_rule_match_address_prefix XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); } -struct route_map_rule_cmd -ospf6_routemap_rule_match_address_prefixlist_cmd = -{ +struct route_map_rule_cmd ospf6_routemap_rule_match_address_prefixlist_cmd = { "ipv6 address prefix-list", ospf6_routemap_rule_match_address_prefixlist, ospf6_routemap_rule_match_address_prefixlist_compile, @@ -855,9 +833,7 @@ ospf6_routemap_rule_set_metric_type_free XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); } -struct route_map_rule_cmd -ospf6_routemap_rule_set_metric_type_cmd = -{ +struct route_map_rule_cmd ospf6_routemap_rule_set_metric_type_cmd = { "metric-type", ospf6_routemap_rule_set_metric_type, ospf6_routemap_rule_set_metric_type_compile, @@ -895,9 +871,7 @@ ospf6_routemap_rule_set_metric_free (voi XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); } -struct route_map_rule_cmd -ospf6_routemap_rule_set_metric_cmd = -{ +struct route_map_rule_cmd ospf6_routemap_rule_set_metric_cmd = { "metric", ospf6_routemap_rule_set_metric, ospf6_routemap_rule_set_metric_compile, @@ -939,9 +913,7 @@ ospf6_routemap_rule_set_forwarding_free XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); } -struct route_map_rule_cmd -ospf6_routemap_rule_set_forwarding_cmd = -{ +struct route_map_rule_cmd ospf6_routemap_rule_set_forwarding_cmd = { "forwarding-address", ospf6_routemap_rule_set_forwarding, ospf6_routemap_rule_set_forwarding_compile, @@ -976,8 +948,7 @@ DEFUN (ospf6_routemap_match_address_pref "Match values\n" IPV6_STR "Match address of route\n" - "Match entries of prefix-lists\n" - "IPv6 prefix-list name\n") + "Match entries of prefix-lists\n" "IPv6 prefix-list name\n") { int ret = route_map_add_match ((struct route_map_index *) vty->index, "ipv6 address prefix-list", argv[0]); @@ -992,8 +963,7 @@ DEFUN (ospf6_routemap_no_match_address_p "Match values\n" IPV6_STR "Match address of route\n" - "Match entries of prefix-lists\n" - "IPv6 prefix-list name\n") + "Match entries of prefix-lists\n" "IPv6 prefix-list name\n") { int ret = route_map_delete_match ((struct route_map_index *) vty->index, "ipv6 address prefix-list", argv[0]); @@ -1006,8 +976,7 @@ DEFUN (ospf6_routemap_set_metric_type, "set metric-type (type-1|type-2)", "Set value\n" "Type of metric\n" - "OSPF6 external type 1 metric\n" - "OSPF6 external type 2 metric\n") + "OSPF6 external type 1 metric\n" "OSPF6 external type 2 metric\n") { int ret = route_map_add_set ((struct route_map_index *) vty->index, "metric-type", argv[0]); @@ -1021,8 +990,7 @@ DEFUN (ospf6_routemap_no_set_metric_type NO_STR "Set value\n" "Type of metric\n" - "OSPF6 external type 1 metric\n" - "OSPF6 external type 2 metric\n") + "OSPF6 external type 1 metric\n" "OSPF6 external type 2 metric\n") { int ret = route_map_delete_set ((struct route_map_index *) vty->index, "metric-type", argv[0]); @@ -1033,9 +1001,7 @@ DEFUN (ospf6_routemap_no_set_metric_type DEFUN (set_metric, set_metric_cmd, "set metric <0-4294967295>", - "Set value\n" - "Metric value\n" - "Metric value\n") + "Set value\n" "Metric value\n" "Metric value\n") { int ret = route_map_add_set ((struct route_map_index *) vty->index, "metric", argv[0]); @@ -1046,10 +1012,7 @@ DEFUN (set_metric, DEFUN (no_set_metric, no_set_metric_cmd, "no set metric <0-4294967295>", - NO_STR - "Set value\n" - "Metric\n" - "METRIC value\n") + NO_STR "Set value\n" "Metric\n" "METRIC value\n") { int ret = route_map_delete_set ((struct route_map_index *) vty->index, "metric", argv[0]); @@ -1060,9 +1023,7 @@ DEFUN (no_set_metric, DEFUN (ospf6_routemap_set_forwarding, ospf6_routemap_set_forwarding_cmd, "set forwarding-address X:X::X:X", - "Set value\n" - "Forwarding Address\n" - "IPv6 Address\n") + "Set value\n" "Forwarding Address\n" "IPv6 Address\n") { int ret = route_map_add_set ((struct route_map_index *) vty->index, "forwarding-address", argv[0]); @@ -1073,10 +1034,7 @@ DEFUN (ospf6_routemap_set_forwarding, DEFUN (ospf6_routemap_no_set_forwarding, ospf6_routemap_no_set_forwarding_cmd, "no set forwarding-address X:X::X:X", - NO_STR - "Set value\n" - "Forwarding Address\n" - "IPv6 Address\n") + NO_STR "Set value\n" "Forwarding Address\n" "IPv6 Address\n") { int ret = route_map_delete_set ((struct route_map_index *) vty->index, "forwarding-address", argv[0]); @@ -1098,7 +1056,8 @@ ospf6_routemap_init () /* Match address prefix-list */ install_element (RMAP_NODE, &ospf6_routemap_match_address_prefixlist_cmd); - install_element (RMAP_NODE, &ospf6_routemap_no_match_address_prefixlist_cmd); + install_element (RMAP_NODE, + &ospf6_routemap_no_match_address_prefixlist_cmd); /* ASE Metric Type (e.g. Type-1/Type-2) */ install_element (RMAP_NODE, &ospf6_routemap_set_metric_type_cmd); @@ -1128,9 +1087,11 @@ ospf6_as_external_lsa_show (struct vty * /* bits */ snprintf (buf, sizeof (buf), "%c%c%c", - (CHECK_FLAG (external->bits_metric, OSPF6_ASBR_BIT_E) ? 'E' : '-'), - (CHECK_FLAG (external->bits_metric, OSPF6_ASBR_BIT_F) ? 'F' : '-'), - (CHECK_FLAG (external->bits_metric, OSPF6_ASBR_BIT_T) ? 'T' : '-')); + (CHECK_FLAG (external->bits_metric, OSPF6_ASBR_BIT_E) ? 'E' : + '-'), (CHECK_FLAG (external->bits_metric, + OSPF6_ASBR_BIT_F) ? 'F' : '-'), + (CHECK_FLAG (external->bits_metric, OSPF6_ASBR_BIT_T) ? 'T' : + '-')); vty_out (vty, " Bits: %s%s", buf, VNL); vty_out (vty, " Metric: %5lu%s", (u_long) OSPF6_ASBR_METRIC (external), @@ -1138,12 +1099,10 @@ ospf6_as_external_lsa_show (struct vty * ospf6_prefix_options_printbuf (external->prefix.prefix_options, buf, sizeof (buf)); - vty_out (vty, " Prefix Options: %s%s", buf, - VNL); + vty_out (vty, " Prefix Options: %s%s", buf, VNL); vty_out (vty, " Referenced LSType: %d%s", - ntohs (external->prefix.prefix_refer_lstype), - VNL); + ntohs (external->prefix.prefix_refer_lstype), VNL); ospf6_prefix_in6_addr (&in6, &external->prefix); inet_ntop (AF_INET6, &in6, buf, sizeof (buf)); @@ -1190,11 +1149,7 @@ ospf6_asbr_external_route_show (struct v DEFUN (show_ipv6_ospf6_redistribute, show_ipv6_ospf6_redistribute_cmd, "show ipv6 ospf6 redistribute", - SHOW_STR - IP6_STR - OSPF6_STR - "redistributing External information\n" - ) + SHOW_STR IP6_STR OSPF6_STR "redistributing External information\n") { struct ospf6_route *route; @@ -1207,8 +1162,7 @@ DEFUN (show_ipv6_ospf6_redistribute, return CMD_SUCCESS; } -struct ospf6_lsa_handler as_external_handler = -{ +struct ospf6_lsa_handler as_external_handler = { OSPF6_LSTYPE_AS_EXTERNAL, "AS-External", ospf6_as_external_lsa_show @@ -1232,11 +1186,7 @@ ospf6_asbr_init () DEFUN (debug_ospf6_asbr, debug_ospf6_asbr_cmd, - "debug ospf6 asbr", - DEBUG_STR - OSPF6_STR - "Debug OSPFv3 ASBR function\n" - ) + "debug ospf6 asbr", DEBUG_STR OSPF6_STR "Debug OSPFv3 ASBR function\n") { OSPF6_DEBUG_ASBR_ON (); return CMD_SUCCESS; @@ -1245,11 +1195,7 @@ DEFUN (debug_ospf6_asbr, DEFUN (no_debug_ospf6_asbr, no_debug_ospf6_asbr_cmd, "no debug ospf6 asbr", - NO_STR - DEBUG_STR - OSPF6_STR - "Debug OSPFv3 ASBR function\n" - ) + NO_STR DEBUG_STR OSPF6_STR "Debug OSPFv3 ASBR function\n") { OSPF6_DEBUG_ASBR_OFF (); return CMD_SUCCESS; --- quagga-0.99.9/ospf6d/ospf6d.c 2006-05-15 03:36:47.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6d.c 2008-04-16 11:55:47.000000000 -0700 @@ -86,19 +87,14 @@ route_prev (struct route_node *node) /* show database functions */ DEFUN (show_version_ospf6, show_version_ospf6_cmd, - "show version ospf6", - SHOW_STR - "Displays ospf6d version\n" - ) + "show version ospf6", SHOW_STR "Displays ospf6d version\n") { - vty_out (vty, "Zebra OSPF6d Version: %s%s", - ospf6_daemon_version, VNL); + vty_out (vty, "Zebra OSPF6d Version: %s%s", ospf6_daemon_version, VNL); return CMD_SUCCESS; } -struct cmd_node debug_node = -{ +struct cmd_node debug_node = { DEBUG_NODE, "", 1 /* VTYSH */ @@ -172,11 +168,7 @@ parse_type_spec (int argc, const char *a DEFUN (show_ipv6_ospf6_database, show_ipv6_ospf6_database_cmd, "show ipv6 ospf6 database", - SHOW_STR - IPV6_STR - OSPF6_STR - "Display Link state database\n" - ) + SHOW_STR IPV6_STR OSPF6_STR "Display Link state database\n") { int level; struct listnode *i, *j; @@ -219,9 +211,7 @@ ALIAS (show_ipv6_ospf6_database, OSPF6_STR "Display Link state database\n" "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ); + "Dump LSAs\n" "Display LSA's internal information\n"); DEFUN (show_ipv6_ospf6_database_type, show_ipv6_ospf6_database_type_cmd, @@ -239,9 +229,7 @@ DEFUN (show_ipv6_ospf6_database_type, "Display As-External LSAs\n" "Display Group-Membership LSAs\n" "Display Type-7 LSAs\n" - "Display Link LSAs\n" - "Display Intra-Area-Prefix LSAs\n" - ) + "Display Link LSAs\n" "Display Intra-Area-Prefix LSAs\n") { int level; struct listnode *i, *j; @@ -313,9 +301,7 @@ ALIAS (show_ipv6_ospf6_database_type, "Display Link LSAs\n" "Display Intra-Area-Prefix LSAs\n" "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ); + "Dump LSAs\n" "Display LSA's internal information\n"); DEFUN (show_ipv6_ospf6_database_id, show_ipv6_ospf6_database_id_cmd, @@ -325,8 +311,7 @@ DEFUN (show_ipv6_ospf6_database_id, OSPF6_STR "Display Link state database\n" "Any Link state Type\n" - "Specify Link state ID as IPv4 address notation\n" - ) + "Specify Link state ID as IPv4 address notation\n") { int level; struct listnode *i, *j; @@ -339,8 +324,7 @@ DEFUN (show_ipv6_ospf6_database_id, if ((inet_pton (AF_INET, argv[0], &id)) != 1) { - vty_out (vty, "Link State ID is not parsable: %s%s", - argv[0], VNL); + vty_out (vty, "Link State ID is not parsable: %s%s", argv[0], VNL); return CMD_SUCCESS; } @@ -382,9 +366,7 @@ ALIAS (show_ipv6_ospf6_database_id, "Any Link state Type\n" "Specify Link state ID as IPv4 address notation\n" "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ); + "Dump LSAs\n" "Display LSA's internal information\n"); ALIAS (show_ipv6_ospf6_database_id, show_ipv6_ospf6_database_linkstate_id_cmd, @@ -394,8 +376,7 @@ ALIAS (show_ipv6_ospf6_database_id, OSPF6_STR "Display Link state database\n" "Search by Link state ID\n" - "Specify Link state ID as IPv4 address notation\n" - ); + "Specify Link state ID as IPv4 address notation\n"); ALIAS (show_ipv6_ospf6_database_id, show_ipv6_ospf6_database_linkstate_id_detail_cmd, @@ -408,9 +389,7 @@ ALIAS (show_ipv6_ospf6_database_id, "Search by Link state ID\n" "Specify Link state ID as IPv4 address notation\n" "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ); + "Dump LSAs\n" "Display LSA's internal information\n"); DEFUN (show_ipv6_ospf6_database_router, show_ipv6_ospf6_database_router_cmd, @@ -421,8 +400,7 @@ DEFUN (show_ipv6_ospf6_database_router, "Display Link state database\n" "Any Link state Type\n" "Any Link state ID\n" - "Specify Advertising Router as IPv4 address notation\n" - ) + "Specify Advertising Router as IPv4 address notation\n") { int level; struct listnode *i, *j; @@ -435,8 +413,7 @@ DEFUN (show_ipv6_ospf6_database_router, if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1) { - vty_out (vty, "Advertising Router is not parsable: %s%s", - argv[0], VNL); + vty_out (vty, "Advertising Router is not parsable: %s%s", argv[0], VNL); return CMD_SUCCESS; } @@ -479,9 +456,7 @@ ALIAS (show_ipv6_ospf6_database_router, "Any Link state ID\n" "Specify Advertising Router as IPv4 address notation\n" "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ); + "Dump LSAs\n" "Display LSA's internal information\n"); ALIAS (show_ipv6_ospf6_database_router, show_ipv6_ospf6_database_adv_router_cmd, @@ -491,8 +466,7 @@ ALIAS (show_ipv6_ospf6_database_router, OSPF6_STR "Display Link state database\n" "Search by Advertising Router\n" - "Specify Advertising Router as IPv4 address notation\n" - ); + "Specify Advertising Router as IPv4 address notation\n"); ALIAS (show_ipv6_ospf6_database_router, show_ipv6_ospf6_database_adv_router_detail_cmd, @@ -505,9 +479,7 @@ ALIAS (show_ipv6_ospf6_database_router, "Search by Advertising Router\n" "Specify Advertising Router as IPv4 address notation\n" "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ); + "Dump LSAs\n" "Display LSA's internal information\n"); DEFUN (show_ipv6_ospf6_database_type_id, show_ipv6_ospf6_database_type_id_cmd, @@ -527,8 +499,7 @@ DEFUN (show_ipv6_ospf6_database_type_id, "Display Type-7 LSAs\n" "Display Link LSAs\n" "Display Intra-Area-Prefix LSAs\n" - "Specify Link state ID as IPv4 address notation\n" - ) + "Specify Link state ID as IPv4 address notation\n") { int level; struct listnode *i, *j; @@ -546,8 +517,7 @@ DEFUN (show_ipv6_ospf6_database_type_id, if ((inet_pton (AF_INET, argv[0], &id)) != 1) { - vty_out (vty, "Link state ID is not parsable: %s%s", - argv[0], VNL); + vty_out (vty, "Link state ID is not parsable: %s%s", argv[0], VNL); return CMD_SUCCESS; } @@ -612,9 +582,7 @@ ALIAS (show_ipv6_ospf6_database_type_id, "Display Intra-Area-Prefix LSAs\n" "Specify Link state ID as IPv4 address notation\n" "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ); + "Dump LSAs\n" "Display LSA's internal information\n"); ALIAS (show_ipv6_ospf6_database_type_id, show_ipv6_ospf6_database_type_linkstate_id_cmd, @@ -635,8 +603,7 @@ ALIAS (show_ipv6_ospf6_database_type_id, "Display Link LSAs\n" "Display Intra-Area-Prefix LSAs\n" "Search by Link state ID\n" - "Specify Link state ID as IPv4 address notation\n" - ); + "Specify Link state ID as IPv4 address notation\n"); ALIAS (show_ipv6_ospf6_database_type_id, show_ipv6_ospf6_database_type_linkstate_id_detail_cmd, @@ -660,9 +627,7 @@ ALIAS (show_ipv6_ospf6_database_type_id, "Search by Link state ID\n" "Specify Link state ID as IPv4 address notation\n" "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ); + "Dump LSAs\n" "Display LSA's internal information\n"); DEFUN (show_ipv6_ospf6_database_type_router, show_ipv6_ospf6_database_type_router_cmd, @@ -683,8 +648,7 @@ DEFUN (show_ipv6_ospf6_database_type_rou "Display Link LSAs\n" "Display Intra-Area-Prefix LSAs\n" "Any Link state ID\n" - "Specify Advertising Router as IPv4 address notation\n" - ) + "Specify Advertising Router as IPv4 address notation\n") { int level; struct listnode *i, *j; @@ -702,8 +666,7 @@ DEFUN (show_ipv6_ospf6_database_type_rou if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1) { - vty_out (vty, "Advertising Router is not parsable: %s%s", - argv[0], VNL); + vty_out (vty, "Advertising Router is not parsable: %s%s", argv[0], VNL); return CMD_SUCCESS; } @@ -728,7 +691,8 @@ DEFUN (show_ipv6_ospf6_database_type_rou { vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL, oi->interface->name, oa->name, VNL, VNL); - ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oi->lsdb); + ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, + oi->lsdb); } } break; @@ -769,9 +733,7 @@ ALIAS (show_ipv6_ospf6_database_type_rou "Any Link state ID\n" "Specify Advertising Router as IPv4 address notation\n" "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ); + "Dump LSAs\n" "Display LSA's internal information\n"); ALIAS (show_ipv6_ospf6_database_type_router, show_ipv6_ospf6_database_type_adv_router_cmd, @@ -792,8 +754,7 @@ ALIAS (show_ipv6_ospf6_database_type_rou "Display Link LSAs\n" "Display Intra-Area-Prefix LSAs\n" "Search by Advertising Router\n" - "Specify Advertising Router as IPv4 address notation\n" - ); + "Specify Advertising Router as IPv4 address notation\n"); ALIAS (show_ipv6_ospf6_database_type_router, show_ipv6_ospf6_database_type_adv_router_detail_cmd, @@ -817,9 +778,7 @@ ALIAS (show_ipv6_ospf6_database_type_rou "Search by Advertising Router\n" "Specify Advertising Router as IPv4 address notation\n" "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ); + "Dump LSAs\n" "Display LSA's internal information\n"); DEFUN (show_ipv6_ospf6_database_id_router, show_ipv6_ospf6_database_id_router_cmd, @@ -830,8 +789,7 @@ DEFUN (show_ipv6_ospf6_database_id_route "Display Link state database\n" "Any Link state Type\n" "Specify Link state ID as IPv4 address notation\n" - "Specify Advertising Router as IPv4 address notation\n" - ) + "Specify Advertising Router as IPv4 address notation\n") { int level; struct listnode *i, *j; @@ -845,8 +803,7 @@ DEFUN (show_ipv6_ospf6_database_id_route if ((inet_pton (AF_INET, argv[0], &id)) != 1) { - vty_out (vty, "Link state ID is not parsable: %s%s", - argv[0], VNL); + vty_out (vty, "Link state ID is not parsable: %s%s", argv[0], VNL); return CMD_SUCCESS; } @@ -855,8 +812,7 @@ DEFUN (show_ipv6_ospf6_database_id_route if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1) { - vty_out (vty, "Advertising Router is not parsable: %s%s", - argv[0], VNL); + vty_out (vty, "Advertising Router is not parsable: %s%s", argv[0], VNL); return CMD_SUCCESS; } @@ -899,9 +855,7 @@ ALIAS (show_ipv6_ospf6_database_id_route "Specify Link state ID as IPv4 address notation\n" "Specify Advertising Router as IPv4 address notation\n" "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ); + "Dump LSAs\n" "Display LSA's internal information\n"); DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id, show_ipv6_ospf6_database_adv_router_linkstate_id_cmd, @@ -913,8 +867,7 @@ DEFUN (show_ipv6_ospf6_database_adv_rout "Search by Advertising Router\n" "Specify Advertising Router as IPv4 address notation\n" "Search by Link state ID\n" - "Specify Link state ID as IPv4 address notation\n" - ) + "Specify Link state ID as IPv4 address notation\n") { int level; struct listnode *i, *j; @@ -928,8 +881,7 @@ DEFUN (show_ipv6_ospf6_database_adv_rout if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1) { - vty_out (vty, "Advertising Router is not parsable: %s%s", - argv[0], VNL); + vty_out (vty, "Advertising Router is not parsable: %s%s", argv[0], VNL); return CMD_SUCCESS; } @@ -938,8 +890,7 @@ DEFUN (show_ipv6_ospf6_database_adv_rout if ((inet_pton (AF_INET, argv[0], &id)) != 1) { - vty_out (vty, "Link state ID is not parsable: %s%s", - argv[0], VNL); + vty_out (vty, "Link state ID is not parsable: %s%s", argv[0], VNL); return CMD_SUCCESS; } @@ -983,9 +934,7 @@ ALIAS (show_ipv6_ospf6_database_adv_rout "Search by Link state ID\n" "Specify Link state ID as IPv4 address notation\n" "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ); + "Dump LSAs\n" "Display LSA's internal information\n"); DEFUN (show_ipv6_ospf6_database_type_id_router, show_ipv6_ospf6_database_type_id_router_cmd, @@ -1006,8 +955,7 @@ DEFUN (show_ipv6_ospf6_database_type_id_ "Display Link LSAs\n" "Display Intra-Area-Prefix LSAs\n" "Specify Link state ID as IPv4 address notation\n" - "Specify Advertising Router as IPv4 address notation\n" - ) + "Specify Advertising Router as IPv4 address notation\n") { int level; struct listnode *i, *j; @@ -1026,8 +974,7 @@ DEFUN (show_ipv6_ospf6_database_type_id_ if ((inet_pton (AF_INET, argv[0], &id)) != 1) { - vty_out (vty, "Link state ID is not parsable: %s%s", - argv[0], VNL); + vty_out (vty, "Link state ID is not parsable: %s%s", argv[0], VNL); return CMD_SUCCESS; } @@ -1036,8 +983,7 @@ DEFUN (show_ipv6_ospf6_database_type_id_ if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1) { - vty_out (vty, "Advertising Router is not parsable: %s%s", - argv[0], VNL); + vty_out (vty, "Advertising Router is not parsable: %s%s", argv[0], VNL); return CMD_SUCCESS; } @@ -1102,9 +1048,7 @@ ALIAS (show_ipv6_ospf6_database_type_id_ "Display Intra-Area-Prefix LSAs\n" "Specify Link state ID as IPv4 address notation\n" "Specify Advertising Router as IPv4 address notation\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ); + "Dump LSAs\n" "Display LSA's internal information\n"); DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id, show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd, @@ -1128,8 +1072,7 @@ DEFUN (show_ipv6_ospf6_database_type_adv "Search by Advertising Router\n" "Specify Advertising Router as IPv4 address notation\n" "Search by Link state ID\n" - "Specify Link state ID as IPv4 address notation\n" - ) + "Specify Link state ID as IPv4 address notation\n") { int level; struct listnode *i, *j; @@ -1148,8 +1091,7 @@ DEFUN (show_ipv6_ospf6_database_type_adv if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1) { - vty_out (vty, "Advertising Router is not parsable: %s%s", - argv[0], VNL); + vty_out (vty, "Advertising Router is not parsable: %s%s", argv[0], VNL); return CMD_SUCCESS; } @@ -1158,8 +1100,7 @@ DEFUN (show_ipv6_ospf6_database_type_adv if ((inet_pton (AF_INET, argv[0], &id)) != 1) { - vty_out (vty, "Link state ID is not parsable: %s%s", - argv[0], VNL); + vty_out (vty, "Link state ID is not parsable: %s%s", argv[0], VNL); return CMD_SUCCESS; } @@ -1227,18 +1168,12 @@ ALIAS (show_ipv6_ospf6_database_type_adv "Specify Advertising Router as IPv4 address notation\n" "Search by Link state ID\n" "Specify Link state ID as IPv4 address notation\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ); + "Dump LSAs\n" "Display LSA's internal information\n"); DEFUN (show_ipv6_ospf6_database_self_originated, show_ipv6_ospf6_database_self_originated_cmd, "show ipv6 ospf6 database self-originated", - SHOW_STR - IPV6_STR - OSPF6_STR - "Display Self-originated LSAs\n" - ) + SHOW_STR IPV6_STR OSPF6_STR "Display Self-originated LSAs\n") { int level; struct listnode *i, *j; @@ -1286,9 +1221,7 @@ ALIAS (show_ipv6_ospf6_database_self_ori "Display Self-originated LSAs\n" "Display details of LSAs\n" "Dump LSAs\n" - "Display LSA's internal information\n" - ) - + "Display LSA's internal information\n") DEFUN (show_ipv6_ospf6_database_type_self_originated, show_ipv6_ospf6_database_type_self_originated_cmd, "show ipv6 ospf6 database " @@ -1306,9 +1239,7 @@ DEFUN (show_ipv6_ospf6_database_type_sel "Display Group-Membership LSAs\n" "Display Type-7 LSAs\n" "Display Link LSAs\n" - "Display Intra-Area-Prefix LSAs\n" - "Display Self-originated LSAs\n" - ) + "Display Intra-Area-Prefix LSAs\n" "Display Self-originated LSAs\n") { int level; struct listnode *i, *j; @@ -1344,7 +1275,8 @@ DEFUN (show_ipv6_ospf6_database_type_sel { vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL, oi->interface->name, oa->name, VNL, VNL); - ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oi->lsdb); + ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, + oi->lsdb); } } break; @@ -1384,9 +1316,7 @@ ALIAS (show_ipv6_ospf6_database_type_sel "Display Intra-Area-Prefix LSAs\n" "Display Self-originated LSAs\n" "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ); + "Dump LSAs\n" "Display LSA's internal information\n"); DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id, show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd, @@ -1409,8 +1339,7 @@ DEFUN (show_ipv6_ospf6_database_type_sel "Display Intra-Area-Prefix LSAs\n" "Display Self-originated LSAs\n" "Search by Link state ID\n" - "Specify Link state ID as IPv4 address notation\n" - ) + "Specify Link state ID as IPv4 address notation\n") { int level; struct listnode *i, *j; @@ -1429,8 +1358,7 @@ DEFUN (show_ipv6_ospf6_database_type_sel if ((inet_pton (AF_INET, argv[0], &id)) != 1) { - vty_out (vty, "Link State ID is not parsable: %s%s", - argv[0], VNL); + vty_out (vty, "Link State ID is not parsable: %s%s", argv[0], VNL); return CMD_SUCCESS; } @@ -1499,9 +1427,7 @@ ALIAS (show_ipv6_ospf6_database_type_sel "Search by Link state ID\n" "Specify Link state ID as IPv4 address notation\n" "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ); + "Dump LSAs\n" "Display LSA's internal information\n"); DEFUN (show_ipv6_ospf6_database_type_id_self_originated, show_ipv6_ospf6_database_type_id_self_originated_cmd, @@ -1522,8 +1448,7 @@ DEFUN (show_ipv6_ospf6_database_type_id_ "Display Link LSAs\n" "Display Intra-Area-Prefix LSAs\n" "Specify Link state ID as IPv4 address notation\n" - "Display Self-originated LSAs\n" - ) + "Display Self-originated LSAs\n") { int level; struct listnode *i, *j; @@ -1542,8 +1467,7 @@ DEFUN (show_ipv6_ospf6_database_type_id_ if ((inet_pton (AF_INET, argv[0], &id)) != 1) { - vty_out (vty, "Link State ID is not parsable: %s%s", - argv[0], VNL); + vty_out (vty, "Link State ID is not parsable: %s%s", argv[0], VNL); return CMD_SUCCESS; } @@ -1612,19 +1536,13 @@ ALIAS (show_ipv6_ospf6_database_type_id_ "Search by Link state ID\n" "Specify Link state ID as IPv4 address notation\n" "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ); + "Dump LSAs\n" "Display LSA's internal information\n"); DEFUN (show_ipv6_ospf6_border_routers, show_ipv6_ospf6_border_routers_cmd, "show ipv6 ospf6 border-routers", - SHOW_STR - IP6_STR - OSPF6_STR - "Display routing table for ABR and ASBR\n" - ) + SHOW_STR IP6_STR OSPF6_STR "Display routing table for ABR and ASBR\n") { u_int32_t adv_router; void (*showfunc) (struct vty *, struct ospf6_route *); @@ -1673,18 +1591,12 @@ ALIAS (show_ipv6_ospf6_border_routers, IP6_STR OSPF6_STR "Display routing table for ABR and ASBR\n" - "Specify Router-ID\n" - "Display Detail\n" - ); + "Specify Router-ID\n" "Display Detail\n"); DEFUN (show_ipv6_ospf6_linkstate, show_ipv6_ospf6_linkstate_cmd, "show ipv6 ospf6 linkstate", - SHOW_STR - IP6_STR - OSPF6_STR - "Display linkstate routing table\n" - ) + SHOW_STR IP6_STR OSPF6_STR "Display linkstate routing table\n") { struct listnode *node; struct ospf6_area *oa; @@ -1708,8 +1620,7 @@ ALIAS (show_ipv6_ospf6_linkstate, OSPF6_STR "Display linkstate routing table\n" "Display Router Entry\n" - "Specify Router ID as IPv4 address notation\n" - ); + "Specify Router ID as IPv4 address notation\n"); ALIAS (show_ipv6_ospf6_linkstate, show_ipv6_ospf6_linkstate_network_cmd, @@ -1720,17 +1631,12 @@ ALIAS (show_ipv6_ospf6_linkstate, "Display linkstate routing table\n" "Display Network Entry\n" "Specify Router ID as IPv4 address notation\n" - "Specify Link state ID as IPv4 address notation\n" - ); + "Specify Link state ID as IPv4 address notation\n"); DEFUN (show_ipv6_ospf6_linkstate_detail, show_ipv6_ospf6_linkstate_detail_cmd, "show ipv6 ospf6 linkstate detail", - SHOW_STR - IP6_STR - OSPF6_STR - "Display linkstate routing table\n" - ) + SHOW_STR IP6_STR OSPF6_STR "Display linkstate routing table\n") { const char *sargv[CMD_ARGC_MAX]; int i, sargc; @@ -1788,6 +1693,7 @@ ospf6_init () install_element_ospf6_debug_asbr (); install_element_ospf6_debug_abr (); install_element_ospf6_debug_flood (); + install_element_ospf6_debug_database (); install_element (VIEW_NODE, &show_version_ospf6_cmd); install_element (ENABLE_NODE, &show_version_ospf6_cmd); @@ -1888,4 +1794,36 @@ ospf6_init () thread_add_read (master, ospf6_receive, NULL, ospf6_sock); } +char * +ip2str (u_int32_t addr) +{ + static char str[16]; + unsigned char *ip; + ip = (unsigned char *) &addr; + sprintf (str, "%u.%u.%u.%u", ip[0], ip[1], ip[2], ip[3]); + return str; +} + +void +set_time (struct timeval *t) +{ + struct timeval now; + + gettimeofday (&now, (struct timezone *) NULL); + t->tv_sec = now.tv_sec; + t->tv_usec = now.tv_usec; + return; +} +float +elapsed_time (struct timeval *t) +{ + struct timeval now; + float T; + + gettimeofday (&now, (struct timezone *) NULL); + T = (float) (now.tv_sec - t->tv_sec) + + (float) (now.tv_usec - t->tv_usec) / 1000000; + + return T; +} --- quagga-0.99.9/ospf6d/ospf6d.conf.sample 2004-05-18 14:28:01.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6d.conf.sample 2008-04-16 11:55:44.000000000 -0700 @@ -9,16 +9,30 @@ service advanced-vty ! debug ospf6 neighbor state ! -interface fxp0 - ipv6 ospf6 cost 1 - ipv6 ospf6 hello-interval 10 - ipv6 ospf6 dead-interval 40 - ipv6 ospf6 retransmit-interval 5 - ipv6 ospf6 priority 0 + interface eth0 + ip address 10.0.0.10/32 + ipv6 address a::a/128 + ipv6 ospf6 priority 1 ipv6 ospf6 transmit-delay 1 ipv6 ospf6 instance-id 0 + ipv6 ospf6 ifmtu 1500 + ipv6 ospf6 cost 1 + ipv6 ospf6 hello-interval 2 + ipv6 ospf6 dead-interval 6 + ipv6 ospf6 retransmit-interval 5 + ipv6 ospf6 network manet-designated-router + ipv6 ospf6 ackinterval 1800 + ipv6 ospf6 diffhellos + ipv6 ospf6 backupwaitinterval 2000 + ipv6 ospf6 twohoprefresh 3 + ipv6 ospf6 hellorepeatcount 3 + ipv6 ospf6 adjacencyconnectivity biconnected + ipv6 ospf6 lsafullness mincostlsa + ipv6 ospf6 flood-delay 100 + ipv6 ospf6 smf_mdr_talk ! interface lo0 + ipv6 address 5f0a::/128 ipv6 ospf6 cost 1 ipv6 ospf6 hello-interval 10 ipv6 ospf6 dead-interval 40 @@ -26,11 +40,12 @@ interface lo0 ipv6 ospf6 priority 1 ipv6 ospf6 transmit-delay 1 ipv6 ospf6 instance-id 0 + ipv6 ospf6 network loopback ! router ospf6 router-id 255.1.1.1 redistribute static route-map static-ospf6 - interface fxp0 area 0.0.0.0 + interface eth0 area 0.0.0.0 ! access-list access4 permit 127.0.0.1/32 ! --- quagga-0.99.9/ospf6d/ospf6d.h 2007-02-05 06:15:17.000000000 -0800 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6d.h 2008-04-16 11:55:47.000000000 -0700 @@ -117,6 +117,12 @@ struct route_node *route_prev (struct ro void ospf6_debug (); void ospf6_init (); -#endif /* OSPF6D_H */ - +char *ip2str (u_int32_t addr); +void set_time (struct timeval *t); +float elapsed_time (struct timeval *t); + +typedef char boolean; +#define false 0 +#define true 1 +#endif /* OSPF6D_H */ --- quagga-0.99.9/ospf6d/ospf6_flood.c 2005-01-26 04:46:48.000000000 -0800 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_flood.c 2008-04-16 11:55:47.000000000 -0700 @@ -42,6 +42,9 @@ #include "ospf6_flood.h" + +#include "ospf6d.h" //for settime() + unsigned char conf_debug_ospf6_flooding; struct ospf6_lsdb * @@ -108,10 +111,18 @@ ospf6_lsa_originate (struct ospf6_lsa *l return; } + set_time (&lsa->originated); + + /* store it in the LSDB for self-originated LSAs */ lsdb_self = ospf6_get_scoped_lsdb_self (lsa); ospf6_lsdb_add (ospf6_lsa_copy (lsa), lsdb_self); + if (IS_OSPF6_DEBUG_DATABASE (DATABASE_DETAIL)) + ospf6_debug_lsdb_show (OSPF6_DEBUG_DATABASE_DETAIL, lsdb_self); + else if (IS_OSPF6_DEBUG_DATABASE (DATABASE)) + ospf6_debug_lsdb_show (OSPF6_DEBUG_DATABASE, lsdb_self); + lsa->refresh = thread_add_timer (master, ospf6_lsa_refresh, lsa, LS_REFRESH_TIME); @@ -129,16 +140,14 @@ ospf6_lsa_originate (struct ospf6_lsa *l } void -ospf6_lsa_originate_process (struct ospf6_lsa *lsa, - struct ospf6 *process) +ospf6_lsa_originate_process (struct ospf6_lsa *lsa, struct ospf6 *process) { lsa->lsdb = process->lsdb; ospf6_lsa_originate (lsa); } void -ospf6_lsa_originate_area (struct ospf6_lsa *lsa, - struct ospf6_area *oa) +ospf6_lsa_originate_area (struct ospf6_lsa *lsa, struct ospf6_area *oa) { lsa->lsdb = oa->lsdb; ospf6_lsa_originate (lsa); @@ -236,6 +246,11 @@ ospf6_install_lsa (struct ospf6_lsa *lsa lsa->installed = now; ospf6_lsdb_add (lsa, lsa->lsdb); + + if (IS_OSPF6_DEBUG_DATABASE (DATABASE_DETAIL)) + ospf6_debug_lsdb_show (OSPF6_DEBUG_DATABASE_DETAIL, lsa->lsdb); + else if (IS_OSPF6_DEBUG_DATABASE (DATABASE)) + ospf6_debug_lsdb_show (OSPF6_DEBUG_DATABASE, lsa->lsdb); return; } @@ -251,6 +267,10 @@ ospf6_flood_interface (struct ospf6_neig int retrans_added = 0; int is_debug = 0; + if (oi->type == OSPF6_IFTYPE_LOOPBACK) + return; + + if (IS_OSPF6_DEBUG_FLOODING || IS_OSPF6_DEBUG_FLOOD_TYPE (lsa->header->type)) { @@ -301,7 +321,8 @@ ospf6_flood_interface (struct ospf6_neig if (ospf6_lsa_compare (lsa, req) == 0) { if (is_debug) - zlog_debug ("Requesting the same, remove it, next neighbor"); + zlog_debug + ("Requesting the same, remove it, next neighbor"); ospf6_lsdb_remove (req, on->request_list); continue; } @@ -330,6 +351,8 @@ ospf6_flood_interface (struct ospf6_neig if (is_debug) zlog_debug ("Add retrans-list of this neighbor"); ospf6_increment_retrans_count (lsa); + + //thread_add_timer must be used for delayed events ospf6_lsdb_add (ospf6_lsa_copy (lsa), on->retrans_list); if (on->thread_send_lsupdate == NULL) on->thread_send_lsupdate = @@ -364,11 +387,18 @@ ospf6_flood_interface (struct ospf6_neig zlog_debug ("Received is from the I/F, itself BDR, next interface"); return; } + if (from && from->ospf6_if == oi) + SET_FLAG (lsa->flag, OSPF6_LSA_FLOODBACK); /* (5) flood the LSA out the interface. */ if (is_debug) zlog_debug ("Schedule flooding for the interface"); - if (if_is_broadcast (oi->interface)) + + + if (oi->type == OSPF6_IFTYPE_BROADCAST || + oi->type == OSPF6_IFTYPE_MDR || + oi->type == OSPF6_IFTYPE_POINTOMULTIPOINT || + oi->type == OSPF6_IFTYPE_NBMA) { ospf6_lsdb_add (ospf6_lsa_copy (lsa), oi->lsupdate_list); if (oi->thread_send_lsupdate == NULL) @@ -441,7 +471,8 @@ ospf6_flood (struct ospf6_neighbor *from } void -ospf6_flood_clear_interface (struct ospf6_lsa *lsa, struct ospf6_interface *oi) +ospf6_flood_clear_interface (struct ospf6_lsa *lsa, + struct ospf6_interface *oi) { struct listnode *node, *nnode; struct ospf6_neighbor *on; @@ -522,6 +553,7 @@ ospf6_acknowledge_lsa_bdrouter (struct o { struct ospf6_interface *oi; int is_debug = 0; + struct ospf6_lsa *lsa_ack; if (IS_OSPF6_DEBUG_FLOODING || IS_OSPF6_DEBUG_FLOOD_TYPE (lsa->header->type)) @@ -548,7 +580,8 @@ ospf6_acknowledge_lsa_bdrouter (struct o if (oi->drouter == from->router_id) { if (is_debug) - zlog_debug ("Delayed acknowledgement (BDR & MoreRecent & from DR)"); + zlog_debug + ("Delayed acknowledgement (BDR & MoreRecent & from DR)"); /* Delayed acknowledgement */ ospf6_lsdb_add (ospf6_lsa_copy (lsa), oi->lsack_list); if (oi->thread_send_lsack == NULL) @@ -572,7 +605,8 @@ ospf6_acknowledge_lsa_bdrouter (struct o if (oi->drouter == from->router_id) { if (is_debug) - zlog_debug ("Delayed acknowledgement (BDR & Duplicate & ImpliedAck & from DR)"); + zlog_debug + ("Delayed acknowledgement (BDR & Duplicate & ImpliedAck & from DR)"); /* Delayed acknowledgement */ ospf6_lsdb_add (ospf6_lsa_copy (lsa), oi->lsack_list); if (oi->thread_send_lsack == NULL) @@ -582,7 +616,8 @@ ospf6_acknowledge_lsa_bdrouter (struct o else { if (is_debug) - zlog_debug ("No acknowledgement (BDR & Duplicate & ImpliedAck & ! from DR)"); + zlog_debug + ("No acknowledgement (BDR & Duplicate & ImpliedAck & ! from DR)"); } return; } @@ -766,7 +802,8 @@ ospf6_receive_lsa (struct ospf6_neighbor OSPF6_LSA_SCOPE (new->header->type) == OSPF6_SCOPE_AS) { if (is_debug) - zlog_debug ("AS-External-LSA (or AS-scope LSA) in stub area, discard"); + zlog_debug + ("AS-External-LSA (or AS-scope LSA) in stub area, discard"); ospf6_lsa_delete (new); return; } @@ -839,10 +879,11 @@ ospf6_receive_lsa (struct ospf6_neighbor struct timeval now, res; gettimeofday (&now, (struct timezone *) NULL); timersub (&now, &old->installed, &res); - if (res.tv_sec < MIN_LS_ARRIVAL) + if (res.tv_sec < from->ospf6_if->area->ospf6->minLSArrival) { if (is_debug) - zlog_debug ("LSA can't be updated within MinLSArrival, discard"); + zlog_debug + ("LSA can't be updated within MinLSArrival, discard"); ospf6_lsa_delete (new); return; /* examin next lsa */ } @@ -897,7 +938,8 @@ ospf6_receive_lsa (struct ospf6_neighbor if (is_debug) { - zlog_debug ("Received is not newer, on the neighbor's request-list"); + zlog_debug + ("Received is not newer, on the neighbor's request-list"); zlog_debug ("BadLSReq, discard the received LSA"); } @@ -967,7 +1011,14 @@ ospf6_receive_lsa (struct ospf6_neighbor /* XXX, MinLSArrival check !? RFC 2328 13 (8) */ + ospf6_lsdb_add (ospf6_lsa_copy (old), from->lsupdate_list); + + //should respond to lsa immediately if not a duplicate, but + //this code could respond to lsa before MinLSArrival passes + //RFC 2328 13 (8) + THREAD_OFF (from->thread_send_lsupdate); + from->thread_send_lsupdate = NULL; if (from->thread_send_lsupdate == NULL) from->thread_send_lsupdate = thread_add_event (master, ospf6_lsupdate_send_neighbor, from, 0); @@ -982,10 +1033,7 @@ ospf6_receive_lsa (struct ospf6_neighbor DEFUN (debug_ospf6_flooding, debug_ospf6_flooding_cmd, "debug ospf6 flooding", - DEBUG_STR - OSPF6_STR - "Debug OSPFv3 flooding function\n" - ) + DEBUG_STR OSPF6_STR "Debug OSPFv3 flooding function\n") { OSPF6_DEBUG_FLOODING_ON (); return CMD_SUCCESS; @@ -994,11 +1042,7 @@ DEFUN (debug_ospf6_flooding, DEFUN (no_debug_ospf6_flooding, no_debug_ospf6_flooding_cmd, "no debug ospf6 flooding", - NO_STR - DEBUG_STR - OSPF6_STR - "Debug OSPFv3 flooding function\n" - ) + NO_STR DEBUG_STR OSPF6_STR "Debug OSPFv3 flooding function\n") { OSPF6_DEBUG_FLOODING_OFF (); return CMD_SUCCESS; --- quagga-0.99.9/ospf6d/ospf6_flood.h 2004-09-02 02:27:59.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_flood.h 2008-04-16 11:55:47.000000000 -0700 @@ -39,8 +39,7 @@ struct ospf6_lsdb *ospf6_get_scoped_lsdb void ospf6_lsa_originate (struct ospf6_lsa *lsa); void ospf6_lsa_originate_process (struct ospf6_lsa *lsa, struct ospf6 *process); -void ospf6_lsa_originate_area (struct ospf6_lsa *lsa, - struct ospf6_area *oa); +void ospf6_lsa_originate_area (struct ospf6_lsa *lsa, struct ospf6_area *oa); void ospf6_lsa_originate_interface (struct ospf6_lsa *lsa, struct ospf6_interface *oi); void ospf6_lsa_purge (struct ospf6_lsa *lsa); --- quagga-0.99.9/ospf6d/ospf6_ghc.c 1969-12-31 16:00:00.000000000 -0800 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_ghc.c 2008-04-16 11:55:47.000000000 -0700 @@ -0,0 +1,6 @@ +/* + * Copyright (C) Boeing Co. + */ + +#include + --- quagga-0.99.9/ospf6d/ospf6_ghc.h 1969-12-31 16:00:00.000000000 -0800 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_ghc.h 2008-04-16 11:55:47.000000000 -0700 @@ -0,0 +1,9 @@ +/* + * Copyright (C) 2005 Boeing + */ + +#ifndef OSPF6_GHC_H +#define OSPF6_GHC_H + + +#endif /* OSPF6_GHC_H */ --- quagga-0.99.9/ospf6d/ospf6_interface.c 2006-05-15 03:43:52.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_interface.c 2008-04-16 11:55:47.000000000 -0700 @@ -42,10 +42,12 @@ #include "ospf6_spf.h" #include "ospf6d.h" + + + unsigned char conf_debug_ospf6_interface = 0; -const char *ospf6_interface_state_str[] = -{ +const char *ospf6_interface_state_str[] = { "None", "Down", "Loopback", @@ -79,7 +81,8 @@ ospf6_interface_lsdb_hook (struct ospf6_ { case OSPF6_LSTYPE_LINK: if (OSPF6_INTERFACE (lsa->lsdb->data)->state == OSPF6_INTERFACE_DR) - OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (OSPF6_INTERFACE (lsa->lsdb->data)); + OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (OSPF6_INTERFACE + (lsa->lsdb->data)); ospf6_spf_schedule (OSPF6_INTERFACE (lsa->lsdb->data)->area); break; @@ -121,6 +125,21 @@ ospf6_interface_create (struct interface oi->state = OSPF6_INTERFACE_DOWN; oi->flag = 0; + + + + + + + if (if_is_broadcast (ifp)) + oi->type = OSPF6_IFTYPE_BROADCAST; + else if (if_is_pointopoint (ifp)) + oi->type = OSPF6_IFTYPE_POINTOPOINT; + else if (if_is_loopback (ifp)) + oi->type = OSPF6_IFTYPE_LOOPBACK; + else + oi->type = OSPF6_IFTYPE_BROADCAST; + /* Try to adjust I/O buffer size with IfMtu */ oi->ifmtu = ifp->mtu6; iobuflen = ospf6_iobuf_size (ifp->mtu6); @@ -139,7 +158,8 @@ ospf6_interface_create (struct interface oi->lsdb->hook_remove = ospf6_interface_lsdb_hook; oi->lsdb_self = ospf6_lsdb_create (oi); - oi->route_connected = OSPF6_ROUTE_TABLE_CREATE (INTERFACE, CONNECTED_ROUTES); + oi->route_connected = + OSPF6_ROUTE_TABLE_CREATE (INTERFACE, CONNECTED_ROUTES); oi->route_connected->scope = oi; /* link both */ @@ -191,8 +213,7 @@ ospf6_interface_enable (struct ospf6_int { UNSET_FLAG (oi->flag, OSPF6_INTERFACE_DISABLE); - oi->thread_send_hello = - thread_add_event (master, ospf6_hello_send, oi, 0); + oi->thread_send_hello = thread_add_event (master, ospf6_hello_send, oi, 0); } void @@ -233,7 +255,10 @@ ospf6_interface_get_linklocal_address (s /* linklocal scope check */ if (IN6_IS_ADDR_LINKLOCAL (&c->address->u.prefix6)) + { l = &c->address->u.prefix6; + break; + } } return l; } @@ -361,7 +389,6 @@ ospf6_interface_connected_route_update ( route = ospf6_route_create (); memcpy (&route->prefix, c->address, sizeof (struct prefix)); - apply_mask (&route->prefix); route->type = OSPF6_DEST_TYPE_NETWORK; route->path.area_id = oi->area->area_id; route->path.type = OSPF6_PATH_TYPE_INTRA; @@ -398,13 +425,11 @@ ospf6_interface_state_change (u_char nex if ((prev_state == OSPF6_INTERFACE_DR || prev_state == OSPF6_INTERFACE_BDR) && - (next_state != OSPF6_INTERFACE_DR && - next_state != OSPF6_INTERFACE_BDR)) + (next_state != OSPF6_INTERFACE_DR && next_state != OSPF6_INTERFACE_BDR)) ospf6_leave_alldrouters (oi->interface->ifindex); if ((prev_state != OSPF6_INTERFACE_DR && prev_state != OSPF6_INTERFACE_BDR) && - (next_state == OSPF6_INTERFACE_DR || - next_state == OSPF6_INTERFACE_BDR)) + (next_state == OSPF6_INTERFACE_DR || next_state == OSPF6_INTERFACE_BDR)) ospf6_join_alldrouters (oi->interface->ifindex); OSPF6_ROUTER_LSA_SCHEDULE (oi->area); @@ -591,8 +616,7 @@ interface_up (struct thread *thread) assert (oi && oi->interface); if (IS_OSPF6_DEBUG_INTERFACE) - zlog_debug ("Interface Event %s: [InterfaceUp]", - oi->interface->name); + zlog_debug ("Interface Event %s: [InterfaceUp]", oi->interface->name); /* check physical interface is up */ if (! if_is_up (oi->interface)) @@ -607,8 +631,7 @@ interface_up (struct thread *thread) if (oi->state > OSPF6_INTERFACE_DOWN) { if (IS_OSPF6_DEBUG_INTERFACE) - zlog_debug ("Interface %s already enabled", - oi->interface->name); + zlog_debug ("Interface %s already enabled", oi->interface->name); return 0; } @@ -623,7 +646,8 @@ interface_up (struct thread *thread) thread_add_event (master, ospf6_hello_send, oi, 0); /* decide next interface state */ - if (if_is_pointopoint (oi->interface)) + if (oi->type == OSPF6_IFTYPE_POINTOPOINT || + oi->type == OSPF6_IFTYPE_POINTOMULTIPOINT) ospf6_interface_state_change (OSPF6_INTERFACE_POINTTOPOINT, oi); else if (oi->priority == 0) ospf6_interface_state_change (OSPF6_INTERFACE_DROTHER, oi); @@ -645,8 +669,7 @@ wait_timer (struct thread *thread) assert (oi && oi->interface); if (IS_OSPF6_DEBUG_INTERFACE) - zlog_debug ("Interface Event %s: [WaitTimer]", - oi->interface->name); + zlog_debug ("Interface Event %s: [WaitTimer]", oi->interface->name); if (oi->state == OSPF6_INTERFACE_WAITING) ospf6_interface_state_change (dr_election (oi), oi); @@ -663,8 +686,7 @@ backup_seen (struct thread *thread) assert (oi && oi->interface); if (IS_OSPF6_DEBUG_INTERFACE) - zlog_debug ("Interface Event %s: [BackupSeen]", - oi->interface->name); + zlog_debug ("Interface Event %s: [BackupSeen]", oi->interface->name); if (oi->state == OSPF6_INTERFACE_WAITING) ospf6_interface_state_change (dr_election (oi), oi); @@ -681,12 +703,10 @@ neighbor_change (struct thread *thread) assert (oi && oi->interface); if (IS_OSPF6_DEBUG_INTERFACE) - zlog_debug ("Interface Event %s: [NeighborChange]", - oi->interface->name); + zlog_debug ("Interface Event %s: [NeighborChange]", oi->interface->name); if (oi->state == OSPF6_INTERFACE_DROTHER || - oi->state == OSPF6_INTERFACE_BDR || - oi->state == OSPF6_INTERFACE_DR) + oi->state == OSPF6_INTERFACE_BDR || oi->state == OSPF6_INTERFACE_DR) ospf6_interface_state_change (dr_election (oi), oi); return 0; @@ -701,8 +721,7 @@ loopind (struct thread *thread) assert (oi && oi->interface); if (IS_OSPF6_DEBUG_INTERFACE) - zlog_debug ("Interface Event %s: [LoopInd]", - oi->interface->name); + zlog_debug ("Interface Event %s: [LoopInd]", oi->interface->name); /* XXX not yet */ @@ -720,8 +739,7 @@ interface_down (struct thread *thread) assert (oi && oi->interface); if (IS_OSPF6_DEBUG_INTERFACE) - zlog_debug ("Interface Event %s: [InterfaceDown]", - oi->interface->name); + zlog_debug ("Interface Event %s: [InterfaceDown]", oi->interface->name); /* Leave AllSPFRouters */ if (oi->state > OSPF6_INTERFACE_DOWN) @@ -764,8 +782,7 @@ ospf6_interface_show (struct vty *vty, s type = "UNKNOWN"; vty_out (vty, "%s is %s, type %s%s", - ifp->name, updown[if_is_up (ifp)], type, - VNL); + ifp->name, updown[if_is_up (ifp)], type, VNL); vty_out (vty, " Interface ID: %d%s", ifp->ifindex, VNL); if (ifp->info == NULL) @@ -776,6 +793,19 @@ ospf6_interface_show (struct vty *vty, s else oi = (struct ospf6_interface *) ifp->info; + if (oi->type == OSPF6_IFTYPE_BROADCAST) + type = "BROADCAST"; + else if (oi->type == OSPF6_IFTYPE_LOOPBACK) + type = "LOOPBACK"; + else if (oi->type == OSPF6_IFTYPE_NBMA) + type = "NBMA"; + else if (oi->type == OSPF6_IFTYPE_POINTOMULTIPOINT) + type = "POINT TO MULTIPOINT"; + else if (oi->type == OSPF6_IFTYPE_POINTOPOINT) + type = "POINT TO POINT"; + vty_out (vty, " OSPF6 type %s%s", type, VTY_NEWLINE); + + vty_out (vty, " Internet Address:%s", VNL); for (ALL_LIST_ELEMENTS_RO (ifp->connected, i, c)) @@ -785,16 +815,13 @@ ospf6_interface_show (struct vty *vty, s switch (p->family) { case AF_INET: - vty_out (vty, " inet : %s%s", strbuf, - VNL); + vty_out (vty, " inet : %s%s", strbuf, VNL); break; case AF_INET6: - vty_out (vty, " inet6: %s%s", strbuf, - VNL); + vty_out (vty, " inet6: %s%s", strbuf, VNL); break; default: - vty_out (vty, " ??? : %s%s", strbuf, - VNL); + vty_out (vty, " ??? : %s%s", strbuf, VNL); break; } } @@ -803,29 +830,24 @@ ospf6_interface_show (struct vty *vty, s { vty_out (vty, " Instance ID %d, Interface MTU %d (autodetect: %d)%s", oi->instance_id, oi->ifmtu, ifp->mtu6, VNL); - inet_ntop (AF_INET, &oi->area->area_id, - strbuf, sizeof (strbuf)); - vty_out (vty, " Area ID %s, Cost %hu%s", strbuf, oi->cost, - VNL); + inet_ntop (AF_INET, &oi->area->area_id, strbuf, sizeof (strbuf)); + vty_out (vty, " Area ID %s, Cost %hu%s", strbuf, oi->cost, VNL); } else vty_out (vty, " Not Attached to Area%s", VNL); vty_out (vty, " State %s, Transmit Delay %d sec, Priority %d%s", ospf6_interface_state_str[oi->state], - oi->transdelay, oi->priority, - VNL); + oi->transdelay, oi->priority, VNL); vty_out (vty, " Timer intervals configured:%s", VNL); vty_out (vty, " Hello %d, Dead %d, Retransmit %d%s", - oi->hello_interval, oi->dead_interval, oi->rxmt_interval, - VNL); + oi->hello_interval, oi->dead_interval, oi->rxmt_interval, VNL); inet_ntop (AF_INET, &oi->drouter, drouter, sizeof (drouter)); inet_ntop (AF_INET, &oi->bdrouter, bdrouter, sizeof (bdrouter)); vty_out (vty, " DR: %s BDR: %s%s", drouter, bdrouter, VNL); - vty_out (vty, " Number of I/F scoped LSAs is %u%s", - oi->lsdb->count, VNL); + vty_out (vty, " Number of I/F scoped LSAs is %u%s", oi->lsdb->count, VNL); gettimeofday (&now, (struct timezone *) NULL); @@ -835,8 +857,7 @@ ospf6_interface_show (struct vty *vty, s timerstring (&res, duration, sizeof (duration)); vty_out (vty, " %d Pending LSAs for LSUpdate in Time %s [thread %s]%s", oi->lsupdate_list->count, duration, - (oi->thread_send_lsupdate ? "on" : "off"), - VNL); + (oi->thread_send_lsupdate ? "on" : "off"), VNL); for (lsa = ospf6_lsdb_head (oi->lsupdate_list); lsa; lsa = ospf6_lsdb_next (lsa)) vty_out (vty, " %s%s", lsa->name, VNL); @@ -847,8 +868,7 @@ ospf6_interface_show (struct vty *vty, s timerstring (&res, duration, sizeof (duration)); vty_out (vty, " %d Pending LSAs for LSAck in Time %s [thread %s]%s", oi->lsack_list->count, duration, - (oi->thread_send_lsack ? "on" : "off"), - VNL); + (oi->thread_send_lsack ? "on" : "off"), VNL); for (lsa = ospf6_lsdb_head (oi->lsack_list); lsa; lsa = ospf6_lsdb_next (lsa)) vty_out (vty, " %s%s", lsa->name, VNL); @@ -860,12 +880,7 @@ ospf6_interface_show (struct vty *vty, s DEFUN (show_ipv6_ospf6_interface, show_ipv6_ospf6_interface_ifname_cmd, "show ipv6 ospf6 interface IFNAME", - SHOW_STR - IP6_STR - OSPF6_STR - INTERFACE_STR - IFNAME_STR - ) + SHOW_STR IP6_STR OSPF6_STR INTERFACE_STR IFNAME_STR) { struct interface *ifp; struct listnode *i; @@ -875,8 +890,7 @@ DEFUN (show_ipv6_ospf6_interface, ifp = if_lookup_by_name (argv[0]); if (ifp == NULL) { - vty_out (vty, "No such Interface: %s%s", argv[0], - VNL); + vty_out (vty, "No such Interface: %s%s", argv[0], VNL); return CMD_WARNING; } ospf6_interface_show (vty, ifp); @@ -892,12 +906,7 @@ DEFUN (show_ipv6_ospf6_interface, ALIAS (show_ipv6_ospf6_interface, show_ipv6_ospf6_interface_cmd, - "show ipv6 ospf6 interface", - SHOW_STR - IP6_STR - OSPF6_STR - INTERFACE_STR - ); + "show ipv6 ospf6 interface", SHOW_STR IP6_STR OSPF6_STR INTERFACE_STR); DEFUN (show_ipv6_ospf6_interface_ifname_prefix, show_ipv6_ospf6_interface_ifname_prefix_cmd, @@ -905,10 +914,7 @@ DEFUN (show_ipv6_ospf6_interface_ifname_ SHOW_STR IP6_STR OSPF6_STR - INTERFACE_STR - IFNAME_STR - "Display connected prefixes to advertise\n" - ) + INTERFACE_STR IFNAME_STR "Display connected prefixes to advertise\n") { struct interface *ifp; struct ospf6_interface *oi; @@ -944,9 +950,7 @@ ALIAS (show_ipv6_ospf6_interface_ifname_ IFNAME_STR "Display connected prefixes to advertise\n" OSPF6_ROUTE_ADDRESS_STR - OSPF6_ROUTE_PREFIX_STR - "Dispaly details of the prefixes\n" - ); + OSPF6_ROUTE_PREFIX_STR "Dispaly details of the prefixes\n"); ALIAS (show_ipv6_ospf6_interface_ifname_prefix, show_ipv6_ospf6_interface_ifname_prefix_match_cmd, @@ -958,19 +962,14 @@ ALIAS (show_ipv6_ospf6_interface_ifname_ IFNAME_STR "Display connected prefixes to advertise\n" OSPF6_ROUTE_PREFIX_STR - OSPF6_ROUTE_MATCH_STR - "Dispaly details of the prefixes\n" - ); + OSPF6_ROUTE_MATCH_STR "Dispaly details of the prefixes\n"); DEFUN (show_ipv6_ospf6_interface_prefix, show_ipv6_ospf6_interface_prefix_cmd, "show ipv6 ospf6 interface prefix", SHOW_STR IP6_STR - OSPF6_STR - INTERFACE_STR - "Display connected prefixes to advertise\n" - ) + OSPF6_STR INTERFACE_STR "Display connected prefixes to advertise\n") { struct listnode *i; struct ospf6_interface *oi; @@ -997,9 +996,7 @@ ALIAS (show_ipv6_ospf6_interface_prefix, INTERFACE_STR "Display connected prefixes to advertise\n" OSPF6_ROUTE_ADDRESS_STR - OSPF6_ROUTE_PREFIX_STR - "Dispaly details of the prefixes\n" - ); + OSPF6_ROUTE_PREFIX_STR "Dispaly details of the prefixes\n"); ALIAS (show_ipv6_ospf6_interface_prefix, show_ipv6_ospf6_interface_prefix_match_cmd, @@ -1010,20 +1007,14 @@ ALIAS (show_ipv6_ospf6_interface_prefix, INTERFACE_STR "Display connected prefixes to advertise\n" OSPF6_ROUTE_PREFIX_STR - OSPF6_ROUTE_MATCH_STR - "Dispaly details of the prefixes\n" - ); + OSPF6_ROUTE_MATCH_STR "Dispaly details of the prefixes\n"); /* interface variable set command */ DEFUN (ipv6_ospf6_ifmtu, ipv6_ospf6_ifmtu_cmd, "ipv6 ospf6 ifmtu <1-65535>", - IP6_STR - OSPF6_STR - "Interface MTU\n" - "OSPFv3 Interface MTU\n" - ) + IP6_STR OSPF6_STR "Interface MTU\n" "OSPFv3 Interface MTU\n") { struct ospf6_interface *oi; struct interface *ifp; @@ -1078,12 +1069,7 @@ DEFUN (ipv6_ospf6_ifmtu, DEFUN (no_ipv6_ospf6_ifmtu, no_ipv6_ospf6_ifmtu_cmd, - "no ipv6 ospf6 ifmtu", - NO_STR - IP6_STR - OSPF6_STR - "Interface MTU\n" - ) + "no ipv6 ospf6 ifmtu", NO_STR IP6_STR OSPF6_STR "Interface MTU\n") { struct ospf6_interface *oi; struct interface *ifp; @@ -1128,10 +1115,7 @@ DEFUN (ipv6_ospf6_cost, ipv6_ospf6_cost_cmd, "ipv6 ospf6 cost <1-65535>", IP6_STR - OSPF6_STR - "Interface cost\n" - "Outgoing metric of this interface\n" - ) + OSPF6_STR "Interface cost\n" "Outgoing metric of this interface\n") { struct ospf6_interface *oi; struct interface *ifp; @@ -1177,11 +1162,7 @@ DEFUN (ipv6_ospf6_cost, DEFUN (ipv6_ospf6_hellointerval, ipv6_ospf6_hellointerval_cmd, "ipv6 ospf6 hello-interval <1-65535>", - IP6_STR - OSPF6_STR - "Interval time of Hello packets\n" - SECONDS_STR - ) + IP6_STR OSPF6_STR "Interval time of Hello packets\n" SECONDS_STR) { struct ospf6_interface *oi; struct interface *ifp; @@ -1204,9 +1190,7 @@ DEFUN (ipv6_ospf6_deadinterval, "ipv6 ospf6 dead-interval <1-65535>", IP6_STR OSPF6_STR - "Interval time after which a neighbor is declared down\n" - SECONDS_STR - ) + "Interval time after which a neighbor is declared down\n" SECONDS_STR) { struct ospf6_interface *oi; struct interface *ifp; @@ -1227,11 +1211,7 @@ DEFUN (ipv6_ospf6_deadinterval, DEFUN (ipv6_ospf6_transmitdelay, ipv6_ospf6_transmitdelay_cmd, "ipv6 ospf6 transmit-delay <1-3600>", - IP6_STR - OSPF6_STR - "Transmit delay of this interface\n" - SECONDS_STR - ) + IP6_STR OSPF6_STR "Transmit delay of this interface\n" SECONDS_STR) { struct ospf6_interface *oi; struct interface *ifp; @@ -1255,8 +1235,7 @@ DEFUN (ipv6_ospf6_retransmitinterval, IP6_STR OSPF6_STR "Time between retransmitting lost link state advertisements\n" - SECONDS_STR - ) + SECONDS_STR) { struct ospf6_interface *oi; struct interface *ifp; @@ -1277,11 +1256,7 @@ DEFUN (ipv6_ospf6_retransmitinterval, DEFUN (ipv6_ospf6_priority, ipv6_ospf6_priority_cmd, "ipv6 ospf6 priority <0-255>", - IP6_STR - OSPF6_STR - "Router priority\n" - "Priority value\n" - ) + IP6_STR OSPF6_STR "Router priority\n" "Priority value\n") { struct ospf6_interface *oi; struct interface *ifp; @@ -1306,13 +1281,11 @@ DEFUN (ipv6_ospf6_instance, ipv6_ospf6_instance_cmd, "ipv6 ospf6 instance-id <0-255>", IP6_STR - OSPF6_STR - "Instance ID for this interface\n" - "Instance ID value\n" - ) + OSPF6_STR "Instance ID for this interface\n" "Instance ID value\n") { struct ospf6_interface *oi; struct interface *ifp; + u_char instance_id; ifp = (struct interface *)vty->index; assert (ifp); @@ -1322,7 +1295,25 @@ DEFUN (ipv6_ospf6_instance, oi = ospf6_interface_create (ifp); assert (oi); - oi->instance_id = strtol (argv[0], NULL, 10); + instance_id = (u_char) strtol (argv[0], NULL, 10); + + if (instance_id == oi->instance_id) + { + if (IS_OSPF6_DEBUG_INTERFACE) + zlog_warn + ("%s: ignoring new instance id (same as current instance id): %d", + __func__, instance_id); + } + else + { + oi->instance_id = instance_id; + if (oi->state > OSPF6_INTERFACE_DOWN) + { + thread_execute (master, interface_down, oi, 0); + thread_execute (master, interface_up, oi, 0); + } + } + return CMD_SUCCESS; } @@ -1331,8 +1322,7 @@ DEFUN (ipv6_ospf6_passive, "ipv6 ospf6 passive", IP6_STR OSPF6_STR - "passive interface, No adjacency will be formed on this interface\n" - ) + "passive interface, No adjacency will be formed on this interface\n") { struct ospf6_interface *oi; struct interface *ifp; @@ -1365,8 +1355,7 @@ DEFUN (no_ipv6_ospf6_passive, NO_STR IP6_STR OSPF6_STR - "passive interface: No Adjacency will be formed on this I/F\n" - ) + "passive interface: No Adjacency will be formed on this I/F\n") { struct ospf6_interface *oi; struct interface *ifp; @@ -1381,8 +1370,7 @@ DEFUN (no_ipv6_ospf6_passive, UNSET_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE); THREAD_OFF (oi->thread_send_hello); - oi->thread_send_hello = - thread_add_event (master, ospf6_hello_send, oi, 0); + oi->thread_send_hello = thread_add_event (master, ospf6_hello_send, oi, 0); return CMD_SUCCESS; } @@ -1393,9 +1381,7 @@ DEFUN (ipv6_ospf6_advertise_prefix_list, IP6_STR OSPF6_STR "Advertising options\n" - "Filter prefix using prefix-list\n" - "Prefix list name\n" - ) + "Filter prefix using prefix-list\n" "Prefix list name\n") { struct ospf6_interface *oi; struct interface *ifp; @@ -1424,15 +1410,90 @@ DEFUN (ipv6_ospf6_advertise_prefix_list, return CMD_SUCCESS; } +DEFUN (ipv6_ospf6_network, + ipv6_ospf6_network_cmd, + "ipv6 ospf6 network (broadcast|non-broadcast|point-to-multipoint|point-to-point|loopback|manet-designated-router)", + "IPv6 Information\n" + "OSPF6 interface commands\n" + "Network type\n" + "Specify OSPF6 broadcast multi-access network\n" + "Specify OSPF6 NBMA network\n" + "Specify OSPF6 point-to-multipoint network\n" + "Specify OSPF6 point-to-point network\n" + "Specify OSPF6 loopback\n" + "Specify OSPF6 manet-designated-router (MDR) network\n") +{ + + struct ospf6_interface *oi; + struct interface *ifp; + int old_type; + + ifp = (struct interface *) vty->index; + assert (ifp); + oi = (struct ospf6_interface *) ifp->info; + if (!oi) + oi = ospf6_interface_create (ifp); + assert (oi); + old_type = oi->type; + + if (strncmp (argv[0], "b", 1) == 0) + oi->type = OSPF6_IFTYPE_BROADCAST; + else if (strncmp (argv[0], "n", 1) == 0) + oi->type = OSPF6_IFTYPE_NBMA; + else if (strncmp (argv[0], "point-to-m", 10) == 0) + oi->type = OSPF6_IFTYPE_POINTOMULTIPOINT; + else if (strncmp (argv[0], "point-to-p", 10) == 0) + oi->type = OSPF6_IFTYPE_POINTOPOINT; + else if (strncmp (argv[0], "l", 1) == 0) + oi->type = OSPF6_IFTYPE_LOOPBACK; + + return CMD_SUCCESS; +} + +ALIAS (ipv6_ospf6_network, + ospf6_network_cmd, + "ospf6 network (broadcast|non-broadcast|point-to-multipoint|point-to-point|loopback|manet-designated-router)", + "OSPF interface commands\n" + "Network type\n" + "Specify OSPF6 broadcast multi-access network\n" + "Specify OSPF6 NBMA network\n" + "Specify OSPF6 point-to-multipoint network\n" + "Specify OSPF6 point-to-point network\n" + "Specify OSPF6 loopback\n" + "Specify OSPF6 manet-designated-router (MDR) network\n") +DEFUN (no_ipv6_ospf6_network, + no_ipv6_ospf6_network_cmd, + "no ipv6 ospf6 network", + NO_STR + "IP Information\n" "OSPF6 interface commands\n" "Network type\n") +{ + struct ospf6_interface *oi; + struct interface *ifp; + int old_type; + + ifp = (struct interface *) vty->index; + assert (ifp); + oi = (struct ospf6_interface *) ifp->info; + if (!oi) + oi = ospf6_interface_create (ifp); + assert (oi); + old_type = oi->type; + + oi->type = OSPF6_IFTYPE_NONE; + + return CMD_SUCCESS; +} + +ALIAS (no_ipv6_ospf6_network, + no_ospf6_network_cmd, + "no ospf6 network", + NO_STR "OSPF6 interface commands\n" "Network type\n") DEFUN (no_ipv6_ospf6_advertise_prefix_list, no_ipv6_ospf6_advertise_prefix_list_cmd, "no ipv6 ospf6 advertise prefix-list", NO_STR IP6_STR - OSPF6_STR - "Advertising options\n" - "Filter prefix using prefix-list\n" - ) + OSPF6_STR "Advertising options\n" "Filter prefix using prefix-list\n") { struct ospf6_interface *oi; struct interface *ifp; @@ -1476,28 +1537,42 @@ config_write_ospf6_interface (struct vty if (oi == NULL) continue; - vty_out (vty, "interface %s%s", - oi->interface->name, VNL); + vty_out (vty, "interface %s%s", oi->interface->name, VNL); if (ifp->desc) vty_out (vty, " description %s%s", ifp->desc, VNL); if (ifp->mtu6 != oi->ifmtu) vty_out (vty, " ipv6 ospf6 ifmtu %d%s", oi->ifmtu, VNL); - vty_out (vty, " ipv6 ospf6 cost %d%s", - oi->cost, VNL); + vty_out (vty, " ipv6 ospf6 cost %d%s", oi->cost, VNL); vty_out (vty, " ipv6 ospf6 hello-interval %d%s", oi->hello_interval, VNL); - vty_out (vty, " ipv6 ospf6 dead-interval %d%s", - oi->dead_interval, VNL); + vty_out (vty, " ipv6 ospf6 dead-interval %d%s", oi->dead_interval, VNL); vty_out (vty, " ipv6 ospf6 retransmit-interval %d%s", oi->rxmt_interval, VNL); - vty_out (vty, " ipv6 ospf6 priority %d%s", - oi->priority, VNL); - vty_out (vty, " ipv6 ospf6 transmit-delay %d%s", - oi->transdelay, VNL); - vty_out (vty, " ipv6 ospf6 instance-id %d%s", - oi->instance_id, VNL); + vty_out (vty, " ipv6 ospf6 priority %d%s", oi->priority, VNL); + vty_out (vty, " ipv6 ospf6 transmit-delay %d%s", oi->transdelay, VNL); + vty_out (vty, " ipv6 ospf6 instance-id %d%s", oi->instance_id, VNL); + switch (oi->type) + { + case OSPF6_IFTYPE_BROADCAST: + vty_out (vty, " ipv6 ospf6 network broadcast%s", VNL); + break; + case OSPF6_IFTYPE_NBMA: + vty_out (vty, " ipv6 ospf6 network non-broadcast%s", VNL); + break; + case OSPF6_IFTYPE_POINTOMULTIPOINT: + vty_out (vty, " ipv6 ospf6 network point-to-multipoint%s", VNL); + break; + case OSPF6_IFTYPE_POINTOPOINT: + vty_out (vty, " ipv6 ospf6 network point-to-point %s", VNL); + break; + case OSPF6_IFTYPE_LOOPBACK: + vty_out (vty, " ipv6 ospf6 network loopback%s", VNL); + break; + } + + if (oi->plist_name) vty_out (vty, " ipv6 ospf6 advertise prefix-list %s%s", @@ -1511,8 +1586,7 @@ config_write_ospf6_interface (struct vty return 0; } -struct cmd_node interface_node = -{ +struct cmd_node interface_node = { INTERFACE_NODE, "%s(config-if)# ", 1 /* VTYSH */ @@ -1530,16 +1604,20 @@ ospf6_interface_init () install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_match_cmd); install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_cmd); install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_cmd); - install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_detail_cmd); - install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_match_cmd); + install_element (VIEW_NODE, + &show_ipv6_ospf6_interface_ifname_prefix_detail_cmd); + install_element (VIEW_NODE, + &show_ipv6_ospf6_interface_ifname_prefix_match_cmd); install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_cmd); install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_cmd); install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_detail_cmd); install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_match_cmd); install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_cmd); install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_cmd); - install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_detail_cmd); - install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_match_cmd); + install_element (ENABLE_NODE, + &show_ipv6_ospf6_interface_ifname_prefix_detail_cmd); + install_element (ENABLE_NODE, + &show_ipv6_ospf6_interface_ifname_prefix_match_cmd); install_element (CONFIG_NODE, &interface_cmd); install_default (INTERFACE_NODE); @@ -1560,15 +1638,21 @@ ospf6_interface_init () install_element (INTERFACE_NODE, &ipv6_ospf6_advertise_prefix_list_cmd); install_element (INTERFACE_NODE, &no_ipv6_ospf6_advertise_prefix_list_cmd); + + install_element (INTERFACE_NODE, &ipv6_ospf6_network_cmd); + install_element (INTERFACE_NODE, &ospf6_network_cmd); + install_element (INTERFACE_NODE, &no_ipv6_ospf6_network_cmd); + install_element (INTERFACE_NODE, &no_ospf6_network_cmd); + + + + } DEFUN (debug_ospf6_interface, debug_ospf6_interface_cmd, "debug ospf6 interface", - DEBUG_STR - OSPF6_STR - "Debug OSPFv3 Interface\n" - ) + DEBUG_STR OSPF6_STR "Debug OSPFv3 Interface\n") { OSPF6_DEBUG_INTERFACE_ON (); return CMD_SUCCESS; @@ -1577,11 +1661,7 @@ DEFUN (debug_ospf6_interface, DEFUN (no_debug_ospf6_interface, no_debug_ospf6_interface_cmd, "no debug ospf6 interface", - NO_STR - DEBUG_STR - OSPF6_STR - "Debug OSPFv3 Interface\n" - ) + NO_STR DEBUG_STR OSPF6_STR "Debug OSPFv3 Interface\n") { OSPF6_DEBUG_INTERFACE_OFF (); return CMD_SUCCESS; --- quagga-0.99.9/ospf6d/ospf6_interface.h 2005-04-04 21:48:42.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_interface.h 2008-04-16 11:55:47.000000000 -0700 @@ -102,8 +106,28 @@ struct ospf6_interface /* prefix-list name to filter connected prefix */ char *plist_name; + + + /* OSPF6 Interface Type */ + u_char type; + + + + + }; + +#define OSPF6_IFTYPE_NONE 0 +#define OSPF6_IFTYPE_POINTOPOINT 1 +#define OSPF6_IFTYPE_BROADCAST 2 +#define OSPF6_IFTYPE_NBMA 3 +#define OSPF6_IFTYPE_POINTOMULTIPOINT 4 +#define OSPF6_IFTYPE_VIRTUALLINK 5 +#define OSPF6_IFTYPE_LOOPBACK 6 +#define OSPF6_IFTYPE_MDR 7 +#define OSPF6_IFTYPE_MAX 8 + /* interface state */ #define OSPF6_INTERFACE_NONE 0 #define OSPF6_INTERFACE_DOWN 1 @@ -148,5 +172,7 @@ void ospf6_interface_init (); int config_write_ospf6_debug_interface (struct vty *vty); void install_element_ospf6_debug_interface (); -#endif /* OSPF6_INTERFACE_H */ + + +#endif /* OSPF6_INTERFACE_H */ --- quagga-0.99.9/ospf6d/ospf6_intra.c 2006-05-15 03:43:52.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_intra.c 2008-04-16 11:55:47.000000000 -0700 @@ -48,6 +48,8 @@ #include "ospf6d.h" +#include "ospf6_flood.h" + unsigned char conf_debug_ospf6_brouter = 0; u_int32_t conf_debug_ospf6_brouter_specific_router_id; u_int32_t conf_debug_ospf6_brouter_specific_area_id; @@ -215,7 +218,8 @@ ospf6_router_lsa_originate (struct threa } /* Point-to-Point interfaces */ - if (if_is_pointopoint (oi->interface)) + if (oi->type == OSPF6_IFTYPE_POINTOPOINT || + oi->type == OSPF6_IFTYPE_POINTOMULTIPOINT) { for (ALL_LIST_ELEMENTS_RO (oi->neighbor_list, j, on)) { @@ -233,7 +236,7 @@ ospf6_router_lsa_originate (struct threa } /* Broadcast and NBMA interfaces */ - if (if_is_broadcast (oi->interface)) + if (oi->type == OSPF6_IFTYPE_BROADCAST || oi->type == OSPF6_IFTYPE_NBMA) { /* If this router is not DR, and If this router not fully adjacent with DR, @@ -380,7 +383,8 @@ ospf6_network_lsa_originate (struct thre } if (IS_OSPF6_DEBUG_ORIGINATE (NETWORK)) - zlog_debug ("Originate Network-LSA for Interface %s", oi->interface->name); + zlog_debug ("Originate Network-LSA for Interface %s", + oi->interface->name); /* If none of neighbor is adjacent to us */ count = 0; @@ -502,15 +506,13 @@ ospf6_link_lsa_show (struct vty *vty, st "LA" : "--"); nu = (CHECK_FLAG (prefix->prefix_options, OSPF6_PREFIX_OPTION_NU) ? "NU" : "--"); - vty_out (vty, " Prefix Options: %s|%s|%s|%s%s", - p, mc, la, nu, VNL); + vty_out (vty, " Prefix Options: %s|%s|%s|%s%s", p, mc, la, nu, VNL); memset (&in6, 0, sizeof (in6)); memcpy (&in6, OSPF6_PREFIX_BODY (prefix), OSPF6_PREFIX_SPACE (prefix->prefix_length)); inet_ntop (AF_INET6, &in6, buf, sizeof (buf)); - vty_out (vty, " Prefix: %s/%d%s", - buf, prefix->prefix_length, VNL); + vty_out (vty, " Prefix: %s/%d%s", buf, prefix->prefix_length, VNL); } return 0; @@ -658,15 +663,13 @@ ospf6_intra_prefix_lsa_show (struct vty "LA" : "--"); nu = (CHECK_FLAG (prefix->prefix_options, OSPF6_PREFIX_OPTION_NU) ? "NU" : "--"); - vty_out (vty, " Prefix Options: %s|%s|%s|%s%s", - p, mc, la, nu, VNL); + vty_out (vty, " Prefix Options: %s|%s|%s|%s%s", p, mc, la, nu, VNL); memset (&in6, 0, sizeof (in6)); memcpy (&in6, OSPF6_PREFIX_BODY (prefix), OSPF6_PREFIX_SPACE (prefix->prefix_length)); inet_ntop (AF_INET6, &in6, buf, sizeof (buf)); - vty_out (vty, " Prefix: %s/%d%s", - buf, prefix->prefix_length, VNL); + vty_out (vty, " Prefix: %s/%d%s", buf, prefix->prefix_length, VNL); } return 0; @@ -721,14 +724,17 @@ ospf6_intra_prefix_lsa_originate_stub (s intra_prefix_lsa->ref_id = htonl (0); intra_prefix_lsa->ref_adv_router = oa->ospf6->router_id; - route_advertise = ospf6_route_table_create (0, 0); + prefix_num = 0; + op = (struct ospf6_prefix *) + ((caddr_t) intra_prefix_lsa + sizeof (struct ospf6_intra_prefix_lsa)); for (ALL_LIST_ELEMENTS_RO (oa->if_list, i, oi)) { if (oi->state == OSPF6_INTERFACE_DOWN) { if (IS_OSPF6_DEBUG_ORIGINATE (INTRA_PREFIX)) - zlog_debug (" Interface %s is down, ignore", oi->interface->name); + zlog_debug (" Interface %s is down, ignore", + oi->interface->name); continue; } @@ -739,8 +745,7 @@ ospf6_intra_prefix_lsa_originate_stub (s full_count++; if (oi->state != OSPF6_INTERFACE_LOOPBACK && - oi->state != OSPF6_INTERFACE_POINTTOPOINT && - full_count != 0) + oi->state != OSPF6_INTERFACE_POINTTOPOINT && full_count != 0) { if (IS_OSPF6_DEBUG_ORIGINATE (INTRA_PREFIX)) zlog_debug (" Interface %s is not stub, ignore", @@ -760,35 +765,26 @@ ospf6_intra_prefix_lsa_originate_stub (s prefix2str (&route->prefix, buf, sizeof (buf)); zlog_debug (" include %s", buf); } - ospf6_route_add (ospf6_route_copy (route), route_advertise); - } - } - - if (route_advertise->count == 0) - { - if (old) - ospf6_lsa_purge (old); - ospf6_route_table_delete (route_advertise); - return 0; - } - - /* put prefixes to advertise */ - prefix_num = 0; - op = (struct ospf6_prefix *) - ((caddr_t) intra_prefix_lsa + sizeof (struct ospf6_intra_prefix_lsa)); - for (route = ospf6_route_head (route_advertise); route; - route = ospf6_route_best_next (route)) - { +//RFC 2740 3.4.3.7 Bullet 5 -- + if (oi->type == OSPF6_IFTYPE_POINTOMULTIPOINT) + op->prefix_length = 128; + else op->prefix_length = route->prefix.prefixlen; op->prefix_options = route->path.prefix_options; + op->prefix_options |= OSPF6_PREFIX_OPTION_LA; op->prefix_metric = htons (route->path.cost); memcpy (OSPF6_PREFIX_BODY (op), &route->prefix.u.prefix6, OSPF6_PREFIX_SPACE (op->prefix_length)); + //must add mask application here because it was removed + //in ospf6_interface.c, ospf6_interface_connected_route_update() + ospf6_prefix_apply_mask (op); op = OSPF6_PREFIX_NEXT (op); prefix_num++; } + } - ospf6_route_table_delete (route_advertise); + if (prefix_num == 0 && old) + ospf6_lsa_purge (old); if (prefix_num == 0) { @@ -943,6 +939,9 @@ ospf6_intra_prefix_lsa_originate_transit route->prefix.family = AF_INET6; route->prefix.prefixlen = op->prefix_length; memset (&route->prefix.u.prefix6, 0, sizeof (struct in6_addr)); + //must add mask application here because it was removed + //in ospf6_interface.c, ospf6_interface_connected_route_update() + ospf6_prefix_apply_mask (op); memcpy (&route->prefix.u.prefix6, OSPF6_PREFIX_BODY (op), OSPF6_PREFIX_SPACE (op->prefix_length)); @@ -1065,9 +1064,13 @@ ospf6_intra_prefix_lsa_add (struct ospf6 return; } + //There is no need to add my own networks because the kernel routing + //table already installs them + if (lsa->header->adv_router == oa->ospf6->router_id) + return; + prefix_num = ntohs (intra_prefix_lsa->prefix_num); - start = (caddr_t) intra_prefix_lsa + - sizeof (struct ospf6_intra_prefix_lsa); + start = (caddr_t) intra_prefix_lsa + sizeof (struct ospf6_intra_prefix_lsa); end = OSPF6_LSA_END (lsa->header); for (current = start; current < end; current += OSPF6_PREFIX_SIZE (op)) { @@ -1092,8 +1095,7 @@ ospf6_intra_prefix_lsa_add (struct ospf6 route->path.area_id = oa->area_id; route->path.type = OSPF6_PATH_TYPE_INTRA; route->path.metric_type = 1; - route->path.cost = ls_entry->path.cost + - ntohs (op->prefix_metric); + route->path.cost = ls_entry->path.cost + ntohs (op->prefix_metric); for (i = 0; ospf6_nexthop_is_set (&ls_entry->nexthop[i]) && i < OSPF6_MULTI_PATH_LIMIT; i++) @@ -1134,8 +1136,7 @@ ospf6_intra_prefix_lsa_remove (struct os OSPF6_LSA_HEADER_END (lsa->header); prefix_num = ntohs (intra_prefix_lsa->prefix_num); - start = (caddr_t) intra_prefix_lsa + - sizeof (struct ospf6_intra_prefix_lsa); + start = (caddr_t) intra_prefix_lsa + sizeof (struct ospf6_intra_prefix_lsa); end = OSPF6_LSA_END (lsa->header); for (current = start; current < end; current += OSPF6_PREFIX_SIZE (op)) { @@ -1191,6 +1192,7 @@ ospf6_intra_route_calculation (struct os struct ospf6_lsa *lsa; void (*hook_add) (struct ospf6_route *) = NULL; void (*hook_remove) (struct ospf6_route *) = NULL; + int pass; if (IS_OSPF6_DEBUG_EXAMIN (INTRA_PREFIX)) zlog_debug ("Re-examin intra-routes for area %s", oa->name); @@ -1212,26 +1214,99 @@ ospf6_intra_route_calculation (struct os oa->route_table->hook_add = hook_add; oa->route_table->hook_remove = hook_remove; + for (pass = 0; pass < 2; pass++) + { + int skipped = 0; + for (route = ospf6_route_head (oa->route_table); route; route = ospf6_route_next (route)) { if (CHECK_FLAG (route->flag, OSPF6_ROUTE_REMOVE) && CHECK_FLAG (route->flag, OSPF6_ROUTE_ADD)) { - UNSET_FLAG (route->flag, OSPF6_ROUTE_REMOVE); - UNSET_FLAG (route->flag, OSPF6_ROUTE_ADD); + /* route unchanged */ + route->flag = 0; } - - if (CHECK_FLAG (route->flag, OSPF6_ROUTE_REMOVE)) + else if (CHECK_FLAG (route->flag, OSPF6_ROUTE_REMOVE)) + { + /* remove route */ ospf6_route_remove (route, oa->route_table); + route->flag = 0; + } else if (CHECK_FLAG (route->flag, OSPF6_ROUTE_ADD) || CHECK_FLAG (route->flag, OSPF6_ROUTE_CHANGE)) { + /* add route */ + int i; + + for (i = 0; ospf6_nexthop_is_set (&route->nexthop[i]) && + i < OSPF6_MULTI_PATH_LIMIT; i++) + { + int routablenexthop = 0; + + if (route->nexthop[i].ifindex && + IN6_IS_ADDR_UNSPECIFIED (&route->nexthop[i].address)) + routablenexthop = 1; + else + { + struct prefix prefix; + struct ospf6_route *nhroute; + + memset (&prefix, 0, sizeof (prefix)); + prefix.family = AF_INET6; + prefix.prefixlen = IPV6_MAX_PREFIXLEN; + IPV6_ADDR_COPY (&prefix.u.prefix6, + &route->nexthop[i].address); + + nhroute = + ospf6_route_lookup_bestmatch (&prefix, + oa->route_table); + + /* nhroute->flag == 0 implies that nhroute has already + * been processed since route->flag is cleared in each + * case. route is skipped if nhroute has not been + * processed yet because zebra or the kernel can reject + * routes with unreachable nexthops. If skipped, route + * will get added in the second pass since any + * prerequisite nexthops should have been added during the + * first pass. + */ + if (nhroute && nhroute->flag == 0) + routablenexthop = 1; + } + + if (routablenexthop) + { if (hook_add) (*hook_add) (route); - } route->flag = 0; + break; + } + else + { + if (IS_OSPF6_DEBUG_EXAMIN (INTRA_PREFIX) || pass > 0) + { + char buf[INET6_ADDRSTRLEN]; + + inet_ntop (AF_INET6, &route->prefix.u.prefix6, buf, + sizeof (buf)); + zlog_debug + ("%s: pass %d skipping route to %s/%d because nexthop is not routable%s", + __func__, pass, buf, route->prefix.prefixlen, + pass > 0 ? "; this shouldn't happen" : ""); + } + skipped++; + } + } + } + else if (route->flag) + zlog_warn ("%s: unknown route flag(s): 0x%x", __func__, + route->flag); + } + + if (skipped == 0) + break; } if (IS_OSPF6_DEBUG_EXAMIN (INTRA_PREFIX)) @@ -1283,8 +1358,7 @@ ospf6_brouter_debug_print (struct ospf6_ (CHECK_FLAG (brouter->flag, OSPF6_ROUTE_CHANGE) ? "C" : "-")); zlog_info (" path type: %s ls-origin %s id: %s adv-router %s", OSPF6_PATH_TYPE_NAME (brouter->path.type), - ospf6_lstype_name (brouter->path.origin.type), - id, adv_router); + ospf6_lstype_name (brouter->path.origin.type), id, adv_router); zlog_info (" options: %s router-bits: %s metric-type: %d metric: %d/%d", options, capa, brouter->path.metric_type, brouter->path.cost, brouter->path.cost_e2); @@ -1413,29 +1487,25 @@ ospf6_intra_brouter_calculation (struct zlog_info ("border-router calculation for area %s: done", oa->name); } -struct ospf6_lsa_handler router_handler = -{ +struct ospf6_lsa_handler router_handler = { OSPF6_LSTYPE_ROUTER, "Router", ospf6_router_lsa_show }; -struct ospf6_lsa_handler network_handler = -{ +struct ospf6_lsa_handler network_handler = { OSPF6_LSTYPE_NETWORK, "Network", ospf6_network_lsa_show }; -struct ospf6_lsa_handler link_handler = -{ +struct ospf6_lsa_handler link_handler = { OSPF6_LSTYPE_LINK, "Link", ospf6_link_lsa_show }; -struct ospf6_lsa_handler intra_prefix_handler = -{ +struct ospf6_lsa_handler intra_prefix_handler = { OSPF6_LSTYPE_INTRA_PREFIX, "Intra-Prefix", ospf6_intra_prefix_lsa_show @@ -1450,13 +1520,152 @@ ospf6_intra_init (void) ospf6_install_lsa_handler (&intra_prefix_handler); } +//prevent LSAs from being originated before MinLSInterval +void +ospf6_lsa_schedule (struct ospf6_area *oa, struct ospf6_interface *oi, + int type, boolean stub) +{ + struct ospf6 *o = NULL; + struct ospf6_lsa *old; + int link_state_id; + long time_msec = -1; + + switch (type) + { + case OSPF6_LSTYPE_ROUTER: + link_state_id = 0; + o = oa->ospf6; + old = ospf6_lsdb_lookup (htons (type), link_state_id, + o->router_id, oa->lsdb); + break; + case OSPF6_LSTYPE_NETWORK: + link_state_id = oi->interface->ifindex; + o = oi->area->ospf6; + old = ospf6_lsdb_lookup (htons (type), htonl (link_state_id), + o->router_id, oi->area->lsdb); + break; + case OSPF6_LSTYPE_LINK: + link_state_id = oi->interface->ifindex; + o = oi->area->ospf6; + old = ospf6_lsdb_lookup (htons (type), htonl (link_state_id), + o->router_id, oi->lsdb); + break; + case OSPF6_LSTYPE_INTRA_PREFIX: + if (stub) + { + link_state_id = 0; + o = oa->ospf6; + old = ospf6_lsdb_lookup (htons (type), link_state_id, + o->router_id, oa->lsdb); + } + else + { + link_state_id = oi->interface->ifindex; + o = oi->area->ospf6; + old = ospf6_lsdb_lookup (htons (type), htonl (link_state_id), + o->router_id, oi->area->lsdb); + } + break; + default: + zlog_warn ("No such LSA type"); + return; + break; + } + if (old) + { + time_msec = + (long) (((float) o->minLSInterval - + elapsed_time (&old->originated)) * 1000); + } + switch (type) + { + case OSPF6_LSTYPE_ROUTER: + if (time_msec > 0) + { + THREAD_OFF (oa->thread_router_lsa); + oa->thread_router_lsa = + thread_add_timer_msec (master, ospf6_router_lsa_originate, oa, + time_msec); + } + else + { + oa->thread_router_lsa = + thread_add_event (master, ospf6_router_lsa_originate, oa, 0); + } + break; + case OSPF6_LSTYPE_NETWORK: + if (time_msec > 0) + { + THREAD_OFF (oi->thread_network_lsa); + oi->thread_network_lsa = + thread_add_timer_msec (master, ospf6_network_lsa_originate, oi, + time_msec); + } + else + { + oi->thread_network_lsa = + thread_add_event (master, ospf6_network_lsa_originate, oi, 0); + } + break; + case OSPF6_LSTYPE_LINK: + if (time_msec > 0) + { + THREAD_OFF (oi->thread_link_lsa); + oi->thread_link_lsa = + thread_add_timer_msec (master, ospf6_link_lsa_originate, oi, + time_msec); + } + else + { + oi->thread_link_lsa = + thread_add_event (master, ospf6_link_lsa_originate, oi, 0); + } + break; + case OSPF6_LSTYPE_INTRA_PREFIX: + if (stub) + { + if (time_msec > 0) + { + THREAD_OFF (oa->thread_intra_prefix_lsa); + oa->thread_intra_prefix_lsa = + thread_add_timer_msec (master, + ospf6_intra_prefix_lsa_originate_stub, + oa, time_msec); + } + else + { + oa->thread_intra_prefix_lsa = + thread_add_event (master, + ospf6_intra_prefix_lsa_originate_stub, oa, + 0); + } + } + else + { + if (time_msec > 0) + { + THREAD_OFF (oi->thread_intra_prefix_lsa); + oi->thread_intra_prefix_lsa = + thread_add_timer_msec (master, + ospf6_intra_prefix_lsa_originate_transit, + oi, time_msec); + } + else + { + oi->thread_intra_prefix_lsa = + thread_add_event (master, + ospf6_intra_prefix_lsa_originate_transit, + oi, 0); + } + } + break; + } +} + DEFUN (debug_ospf6_brouter, debug_ospf6_brouter_cmd, "debug ospf6 border-routers", - DEBUG_STR - OSPF6_STR - "Debug border router\n" - ) + DEBUG_STR OSPF6_STR "Debug border router\n") { OSPF6_DEBUG_BROUTER_ON (); return CMD_SUCCESS; @@ -1465,11 +1674,7 @@ DEFUN (debug_ospf6_brouter, DEFUN (no_debug_ospf6_brouter, no_debug_ospf6_brouter_cmd, "no debug ospf6 border-routers", - NO_STR - DEBUG_STR - OSPF6_STR - "Debug border router\n" - ) + NO_STR DEBUG_STR OSPF6_STR "Debug border router\n") { OSPF6_DEBUG_BROUTER_OFF (); return CMD_SUCCESS; @@ -1481,9 +1686,7 @@ DEFUN (debug_ospf6_brouter_router, DEBUG_STR OSPF6_STR "Debug border router\n" - "Debug specific border router\n" - "Specify border-router's router-id\n" - ) + "Debug specific border router\n" "Specify border-router's router-id\n") { u_int32_t router_id; inet_pton (AF_INET, argv[0], &router_id); @@ -1496,10 +1699,7 @@ DEFUN (no_debug_ospf6_brouter_router, "no debug ospf6 border-routers router-id", NO_STR DEBUG_STR - OSPF6_STR - "Debug border router\n" - "Debug specific border router\n" - ) + OSPF6_STR "Debug border router\n" "Debug specific border router\n") { OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_OFF (); return CMD_SUCCESS; @@ -1511,9 +1711,7 @@ DEFUN (debug_ospf6_brouter_area, DEBUG_STR OSPF6_STR "Debug border router\n" - "Debug border routers in specific Area\n" - "Specify Area-ID\n" - ) + "Debug border routers in specific Area\n" "Specify Area-ID\n") { u_int32_t area_id; inet_pton (AF_INET, argv[0], &area_id); @@ -1527,9 +1725,7 @@ DEFUN (no_debug_ospf6_brouter_area, NO_STR DEBUG_STR OSPF6_STR - "Debug border router\n" - "Debug border routers in specific Area\n" - ) + "Debug border router\n" "Debug border routers in specific Area\n") { OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_OFF (); return CMD_SUCCESS; --- quagga-0.99.9/ospf6d/ospf6_intra.h 2006-05-15 03:36:47.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_intra.h 2008-04-16 11:55:47.000000000 -0700 @@ -22,6 +22,9 @@ #ifndef OSPF6_INTRA_H #define OSPF6_INTRA_H +#include "ospf6d.h" +#include "ospf6_area.h" + /* Debug option */ extern unsigned char conf_debug_ospf6_brouter; extern u_int32_t conf_debug_ospf6_brouter_specific_router_id; @@ -140,38 +143,33 @@ struct ospf6_intra_prefix_lsa /* followed by ospf6 prefix(es) */ }; - +struct ospf6_interface; +void ospf6_lsa_schedule (struct ospf6_area *oa, struct ospf6_interface *oi, + int type, boolean stub); #define OSPF6_ROUTER_LSA_SCHEDULE(oa) \ do { \ if (! (oa)->thread_router_lsa) \ - (oa)->thread_router_lsa = \ - thread_add_event (master, ospf6_router_lsa_originate, oa, 0); \ + ospf6_lsa_schedule(oa, NULL, OSPF6_LSTYPE_ROUTER, false); \ } while (0) #define OSPF6_NETWORK_LSA_SCHEDULE(oi) \ do { \ if (! (oi)->thread_network_lsa) \ - (oi)->thread_network_lsa = \ - thread_add_event (master, ospf6_network_lsa_originate, oi, 0); \ + ospf6_lsa_schedule(NULL, oi, OSPF6_LSTYPE_NETWORK, false); \ } while (0) #define OSPF6_LINK_LSA_SCHEDULE(oi) \ do { \ if (! (oi)->thread_link_lsa) \ - (oi)->thread_link_lsa = \ - thread_add_event (master, ospf6_link_lsa_originate, oi, 0); \ + ospf6_lsa_schedule(NULL, oi, OSPF6_LSTYPE_LINK, false); \ } while (0) #define OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB(oa) \ do { \ if (! (oa)->thread_intra_prefix_lsa) \ - (oa)->thread_intra_prefix_lsa = \ - thread_add_event (master, ospf6_intra_prefix_lsa_originate_stub, \ - oa, 0); \ + ospf6_lsa_schedule(oa, NULL, OSPF6_LSTYPE_INTRA_PREFIX, true); \ } while (0) #define OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT(oi) \ do { \ if (! (oi)->thread_intra_prefix_lsa) \ - (oi)->thread_intra_prefix_lsa = \ - thread_add_event (master, ospf6_intra_prefix_lsa_originate_transit, \ - oi, 0); \ + ospf6_lsa_schedule(NULL, oi, OSPF6_LSTYPE_INTRA_PREFIX, false); \ } while (0) #define OSPF6_NETWORK_LSA_EXECUTE(oi) \ --- quagga-0.99.9/ospf6d/ospf6_lsa.c 2007-06-14 03:02:14.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_lsa.c 2008-04-16 11:55:47.000000000 -0700 @@ -70,8 +70,7 @@ ospf6_unknown_lsa_show (struct vty *vty, return 0; } -struct ospf6_lsa_handler unknown_handler = -{ +struct ospf6_lsa_handler unknown_handler = { OSPF6_LSTYPE_UNKNOWN, "Unknown", ospf6_unknown_lsa_show, @@ -127,8 +126,7 @@ ospf6_lstype_debug (u_int16_t type) /* RFC2328: Section 13.2 */ int -ospf6_lsa_is_differ (struct ospf6_lsa *lsa1, - struct ospf6_lsa *lsa2) +ospf6_lsa_is_differ (struct ospf6_lsa *lsa1, struct ospf6_lsa *lsa2) { int len; @@ -154,8 +152,7 @@ ospf6_lsa_is_differ (struct ospf6_lsa *l } int -ospf6_lsa_is_changed (struct ospf6_lsa *lsa1, - struct ospf6_lsa *lsa2) +ospf6_lsa_is_changed (struct ospf6_lsa *lsa1, struct ospf6_lsa *lsa2) { int length; @@ -313,8 +310,7 @@ ospf6_lsa_header_print_raw (struct ospf6 { char id[16], adv_router[16]; inet_ntop (AF_INET, &header->id, id, sizeof (id)); - inet_ntop (AF_INET, &header->adv_router, adv_router, - sizeof (adv_router)); + inet_ntop (AF_INET, &header->adv_router, adv_router, sizeof (adv_router)); zlog_debug (" [%s Id:%s Adv:%s]", ospf6_lstype_name (header->type), id, adv_router); zlog_debug (" Age: %4hu SeqNum: %#08lx Cksum: %04hx Len: %d", @@ -409,8 +405,7 @@ ospf6_lsa_show_internal (struct vty *vty vty_out (vty, "LS Sequence Number: %#010lx%s", (u_long) ntohl (lsa->header->seqnum), VNL); vty_out (vty, "CheckSum: %#06hx Length: %hu%s", - ntohs (lsa->header->checksum), - ntohs (lsa->header->length), VNL); + ntohs (lsa->header->checksum), ntohs (lsa->header->length), VNL); vty_out (vty, " Prev: %p This: %p Next: %p%s", lsa->prev, lsa, lsa->next, VNL); vty_out (vty, "%s", VNL); @@ -436,8 +431,7 @@ ospf6_lsa_show (struct vty *vty, struct vty_out (vty, "LS Sequence Number: %#010lx%s", (u_long) ntohl (lsa->header->seqnum), VNL); vty_out (vty, "CheckSum: %#06hx Length: %hu%s", - ntohs (lsa->header->checksum), - ntohs (lsa->header->length), VNL); + ntohs (lsa->header->checksum), ntohs (lsa->header->length), VNL); handler = ospf6_get_lsa_handler (lsa->header->type); if (handler->show == NULL) @@ -594,12 +593,12 @@ ospf6_lsa_expire (struct thread *thread) if (CHECK_FLAG (lsa->flag, OSPF6_LSA_HEADERONLY)) return 0; /* dbexchange will do something ... */ - /* reflood lsa */ - ospf6_flood (NULL, lsa); - /* reinstall lsa */ ospf6_install_lsa (lsa); + /* reflood lsa */ + ospf6_flood (NULL, lsa); + /* schedule maxage remover */ ospf6_maxage_remove (ospf6); @@ -644,6 +643,11 @@ ospf6_lsa_refresh (struct thread *thread /* store it in the LSDB for self-originated LSAs */ ospf6_lsdb_add (ospf6_lsa_copy (new), lsdb_self); + if (IS_OSPF6_DEBUG_DATABASE (DATABASE_DETAIL)) + ospf6_debug_lsdb_show (OSPF6_DEBUG_DATABASE_DETAIL, lsdb_self); + else if (IS_OSPF6_DEBUG_DATABASE (DATABASE)) + ospf6_debug_lsdb_show (OSPF6_DEBUG_DATABASE, lsdb_self); + if (IS_OSPF6_DEBUG_LSA_TYPE (new->header->type)) { zlog_debug ("LSA Refresh:"); @@ -717,8 +722,7 @@ ospf6_lsa_handler_name (struct ospf6_lsa unsigned int i; unsigned int size = strlen (h->name); - if (!strcmp(h->name, "Unknown") && - h->type != OSPF6_LSTYPE_UNKNOWN) + if (!strcmp (h->name, "Unknown") && h->type != OSPF6_LSTYPE_UNKNOWN) { snprintf (buf, sizeof (buf), "%#04hx", h->type); return buf; @@ -741,8 +745,7 @@ DEFUN (debug_ospf6_lsa_type, DEBUG_STR OSPF6_STR "Debug Link State Advertisements (LSAs)\n" - "Specify LS type as Hexadecimal\n" - ) + "Specify LS type as Hexadecimal\n") { unsigned int i; struct ospf6_lsa_handler *handler = NULL; @@ -809,8 +812,7 @@ DEFUN (no_debug_ospf6_lsa_type, DEBUG_STR OSPF6_STR "Debug Link State Advertisements (LSAs)\n" - "Specify LS type as Hexadecimal\n" - ) + "Specify LS type as Hexadecimal\n") { u_int i; struct ospf6_lsa_handler *handler = NULL; --- quagga-0.99.9/ospf6d/ospf6_lsa.h 2004-12-15 09:14:20.000000000 -0800 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_lsa.h 2008-04-16 11:55:47.000000000 -0700 @@ -225,7 +228,8 @@ void ospf6_lsa_show_internal (struct vty void ospf6_lsa_show (struct vty *vty, struct ospf6_lsa *lsa); struct ospf6_lsa *ospf6_lsa_create (struct ospf6_lsa_header *header); -struct ospf6_lsa *ospf6_lsa_create_headeronly (struct ospf6_lsa_header *header); +struct ospf6_lsa *ospf6_lsa_create_headeronly (struct ospf6_lsa_header + *header); void ospf6_lsa_delete (struct ospf6_lsa *lsa); struct ospf6_lsa *ospf6_lsa_copy (struct ospf6_lsa *); @@ -248,5 +252,6 @@ void ospf6_lsa_cmd_init (); int config_write_ospf6_debug_lsa (struct vty *vty); void install_element_ospf6_debug_lsa (); -#endif /* OSPF6_LSA_H */ + +#endif /* OSPF6_LSA_H */ --- quagga-0.99.9/ospf6d/ospf6_lsdb.c 2005-01-26 03:21:05.000000000 -0800 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_lsdb.c 2008-04-16 11:55:47.000000000 -0700 @@ -33,6 +33,9 @@ #include "ospf6_lsdb.h" #include "ospf6d.h" +#include "ospf6_intra.h" +unsigned char conf_debug_ospf6_database = 0; + struct ospf6_lsdb * ospf6_lsdb_create (void *data) { @@ -64,8 +67,7 @@ ospf6_lsdb_set_key (struct prefix_ipv6 * { assert (key->prefixlen % 8 == 0); - memcpy ((caddr_t) &key->prefix + key->prefixlen / 8, - (caddr_t) value, len); + memcpy ((caddr_t) & key->prefix + key->prefixlen / 8, (caddr_t) value, len); key->family = AF_INET6; key->prefixlen += len * 8; } @@ -76,8 +78,7 @@ _lsdb_count_assert (struct ospf6_lsdb *l { struct ospf6_lsa *debug; unsigned int num = 0; - for (debug = ospf6_lsdb_head (lsdb); debug; - debug = ospf6_lsdb_next (debug)) + for (debug = ospf6_lsdb_head (lsdb); debug; debug = ospf6_lsdb_next (debug)) num++; if (num == lsdb->count) @@ -85,8 +86,7 @@ _lsdb_count_assert (struct ospf6_lsdb *l zlog_debug ("PANIC !! lsdb[%p]->count = %d, real = %d", lsdb, lsdb->count, num); - for (debug = ospf6_lsdb_head (lsdb); debug; - debug = ospf6_lsdb_next (debug)) + for (debug = ospf6_lsdb_head (lsdb); debug; debug = ospf6_lsdb_next (debug)) zlog_debug ("%p %p %s lsdb[%p]", debug->prev, debug->next, debug->name, debug->lsdb); zlog_debug ("DUMP END"); @@ -130,9 +130,11 @@ ospf6_lsdb_add (struct ospf6_lsa *lsa, s /* next link */ nextnode = current; route_lock_node (nextnode); - do { + do + { nextnode = route_next (nextnode); - } while (nextnode && nextnode->info == NULL); + } + while (nextnode && nextnode->info == NULL); if (nextnode == NULL) lsa->next = NULL; else @@ -146,9 +148,11 @@ ospf6_lsdb_add (struct ospf6_lsa *lsa, s /* prev link */ prevnode = current; route_lock_node (prevnode); - do { + do + { prevnode = route_prev (prevnode); - } while (prevnode && prevnode->info == NULL); + } + while (prevnode && prevnode->info == NULL); if (prevnode == NULL) lsa->prev = NULL; else @@ -187,6 +191,14 @@ ospf6_lsdb_add (struct ospf6_lsa *lsa, s (*lsdb->hook_add) (lsa); } } + //We are trying to catch a premature aged LSA. + //The pointers to lsa and old are the same because premature aging + //doesn't create a new LSA (it just changes the age value) + else if (old == lsa && OSPF6_LSA_IS_MAXAGE (lsa)) + { + if (lsdb->hook_remove) + (*lsdb->hook_remove) (lsa); + } } else if (OSPF6_LSA_IS_MAXAGE (lsa)) { @@ -228,6 +240,17 @@ ospf6_lsdb_remove (struct ospf6_lsa *lsa node->info = NULL; lsdb->count--; + if (lsa->expire) + { + THREAD_OFF (lsa->expire); + lsa->expire = 0; + } + if (lsa->refresh) + { + THREAD_OFF (lsa->refresh); + lsa->refresh = 0; + } + if (lsdb->hook_remove) (*lsdb->hook_remove) (lsa); @@ -579,4 +602,304 @@ ospf6_new_ls_seqnum (u_int16_t type, u_i return ((u_int32_t) htonl (seqnum)); } +DEFUN (debug_ospf6_database, + debug_ospf6_database_cmd, + "debug ospf6 database", DEBUG_STR OSPF6_STR "Dump ospf6 database\n") +{ + unsigned char level = 0; + level = OSPF6_DEBUG_DATABASE; + OSPF6_DEBUG_DATABASE_ON (level); + return CMD_SUCCESS; +} + +DEFUN (no_debug_ospf6_database, + no_debug_ospf6_database_cmd, + "no debug ospf6 database", + NO_STR DEBUG_STR OSPF6_STR "Dump ospf6 database\n") +{ + unsigned char level = 0; + level = OSPF6_DEBUG_DATABASE; + OSPF6_DEBUG_DATABASE_OFF (level); + return CMD_SUCCESS; +} + +DEFUN (debug_ospf6_database_detail, + debug_ospf6_database_detail_cmd, + "debug ospf6 database detail", + DEBUG_STR OSPF6_STR "Dump ospf6 database\n" "High detail\n") +{ + unsigned char level = 0; + level = OSPF6_DEBUG_DATABASE_DETAIL; + OSPF6_DEBUG_DATABASE_ON (level); + return CMD_SUCCESS; +} + +DEFUN (no_debug_ospf6_database_detail, + no_debug_ospf6_database_detail_cmd, + "no debug ospf6 database detail", + NO_STR DEBUG_STR OSPF6_STR "Dump ospf6 database\n" "High detail\n") +{ + unsigned char level = 0; + level = OSPF6_DEBUG_DATABASE_DETAIL; + OSPF6_DEBUG_DATABASE_OFF (level); + return CMD_SUCCESS; +} + +void +install_element_ospf6_debug_database () +{ + install_element (ENABLE_NODE, &debug_ospf6_database_cmd); + install_element (ENABLE_NODE, &debug_ospf6_database_detail_cmd); + install_element (CONFIG_NODE, &debug_ospf6_database_cmd); + install_element (CONFIG_NODE, &debug_ospf6_database_detail_cmd); + install_element (ENABLE_NODE, &no_debug_ospf6_database_cmd); + install_element (ENABLE_NODE, &no_debug_ospf6_database_detail_cmd); + install_element (CONFIG_NODE, &no_debug_ospf6_database_cmd); + install_element (CONFIG_NODE, &no_debug_ospf6_database_detail_cmd); +} + +void +ospf6_debug_lsdb_show (int level, struct ospf6_lsdb *lsdb) +{ + struct ospf6_lsa *lsa; + char adv_router[16], id[16]; + struct timeval now, res; + char duration[16]; + int count = 0; + + zlog_debug ("DUMPING DATABASE %p", lsdb); + lsa = ospf6_lsdb_head (lsdb); + while (lsa) + { + assert (lsa); + assert (lsa->header); + + inet_ntop (AF_INET, &lsa->header->id, id, sizeof (id)); + inet_ntop (AF_INET, &lsa->header->adv_router, adv_router, + sizeof (adv_router)); + gettimeofday (&now, NULL); + timersub (&now, &lsa->installed, &res); + timerstring (&res, duration, sizeof (duration)); + + if (level == OSPF6_DEBUG_DATABASE) + { + zlog_debug ("%-12s %-15s %-15s %4hu %8lx %04hx %4hu %8s", + ospf6_lstype_name (lsa->header->type), + id, adv_router, ospf6_lsa_age_current (lsa), + (u_long) ntohl (lsa->header->seqnum), + ntohs (lsa->header->checksum), + ntohs (lsa->header->length), duration); + } + else if (level == OSPF6_DEBUG_DATABASE_DETAIL) + { + zlog_debug ("LSA %d", ++count); + zlog_debug (" Age: %4hu Type: %s", ospf6_lsa_age_current (lsa), + ospf6_lstype_name (lsa->header->type)); + zlog_debug (" Link State ID: %s", id); + zlog_debug (" Advertising Router: %s", adv_router); + zlog_debug (" LS Sequence Number: %#010lx", + (u_long) ntohl (lsa->header->seqnum)); + zlog_debug (" CheckSum: %#06hx Length: %hu", + ntohs (lsa->header->checksum), + ntohs (lsa->header->length)); + switch (ntohs (lsa->header->type)) + { + case OSPF6_LSTYPE_ROUTER: + ospf6_debug_router_lsa_show (lsa); + break; + case OSPF6_LSTYPE_NETWORK: + ospf6_debug_network_lsa_show (lsa); + break; + case OSPF6_LSTYPE_LINK: + ospf6_debug_link_lsa_show (lsa); + break; + case OSPF6_LSTYPE_INTRA_PREFIX: + ospf6_debug_intra_prefix_lsa_show (lsa); + break; + default: + zlog_debug (" logging not implemented for LSA %s", lsa->name); + break; + } + } + else + { + zlog_debug ("bad level when displaying database"); + } + lsa = ospf6_lsdb_next (lsa); + } +} + +int +ospf6_debug_router_lsa_show (struct ospf6_lsa *lsa) +{ + char *start, *end, *current; + char buf[32], name[32], bits[16], options[32]; + struct ospf6_router_lsa *router_lsa; + struct ospf6_router_lsdesc *lsdesc; + + router_lsa = (struct ospf6_router_lsa *) + ((char *) lsa->header + sizeof (struct ospf6_lsa_header)); + + ospf6_capability_printbuf (router_lsa->bits, bits, sizeof (bits)); + ospf6_options_printbuf (router_lsa->options, options, sizeof (options)); + zlog_debug (" Bits: %s Options: %s", bits, options); + + start = (char *) router_lsa + sizeof (struct ospf6_router_lsa); + end = (char *) lsa->header + ntohs (lsa->header->length); + for (current = start; current + sizeof (struct ospf6_router_lsdesc) <= end; + current += sizeof (struct ospf6_router_lsdesc)) + { + lsdesc = (struct ospf6_router_lsdesc *) current; + + if (lsdesc->type == OSPF6_ROUTER_LSDESC_POINTTOPOINT) + snprintf (name, sizeof (name), "Point-To-Point"); + else if (lsdesc->type == OSPF6_ROUTER_LSDESC_TRANSIT_NETWORK) + snprintf (name, sizeof (name), "Transit-Network"); + else if (lsdesc->type == OSPF6_ROUTER_LSDESC_STUB_NETWORK) + snprintf (name, sizeof (name), "Stub-Network"); + else if (lsdesc->type == OSPF6_ROUTER_LSDESC_VIRTUAL_LINK) + snprintf (name, sizeof (name), "Virtual-Link"); + else + snprintf (name, sizeof (name), "Unknown (%#x)", lsdesc->type); + + zlog_debug (" Type: %s Metric: %d", name, ntohs (lsdesc->metric)); + zlog_debug (" Interface ID: %s", + inet_ntop (AF_INET, &lsdesc->interface_id, + buf, sizeof (buf))); + zlog_debug (" Neighbor Interface ID: %s", + inet_ntop (AF_INET, &lsdesc->neighbor_interface_id, + buf, sizeof (buf))); + zlog_debug (" Neighbor Router ID: %s", + inet_ntop (AF_INET, &lsdesc->neighbor_router_id, + buf, sizeof (buf))); + } + return 0; +} + +int +ospf6_debug_network_lsa_show (struct ospf6_lsa *lsa) +{ + char *start, *end, *current; + struct ospf6_network_lsa *network_lsa; + struct ospf6_network_lsdesc *lsdesc; + char buf[128], options[32]; + + network_lsa = (struct ospf6_network_lsa *) + ((caddr_t) lsa->header + sizeof (struct ospf6_lsa_header)); + + ospf6_options_printbuf (network_lsa->options, options, sizeof (options)); + zlog_debug (" Options: %s", options); + + start = (char *) network_lsa + sizeof (struct ospf6_network_lsa); + end = (char *) lsa->header + ntohs (lsa->header->length); + for (current = start; current + sizeof (struct ospf6_network_lsdesc) <= end; + current += sizeof (struct ospf6_network_lsdesc)) + { + lsdesc = (struct ospf6_network_lsdesc *) current; + inet_ntop (AF_INET, &lsdesc->router_id, buf, sizeof (buf)); + zlog_debug (" Attached Router: %s", buf); + } + return 0; +} + +int +ospf6_debug_link_lsa_show (struct ospf6_lsa *lsa) +{ + char *start, *end, *current; + struct ospf6_link_lsa *link_lsa; + int prefixnum; + char buf[128], options[32]; + struct ospf6_prefix *prefix; + const char *p, *mc, *la, *nu; + struct in6_addr in6; + + link_lsa = (struct ospf6_link_lsa *) + ((caddr_t) lsa->header + sizeof (struct ospf6_lsa_header)); + + ospf6_options_printbuf (link_lsa->options, options, sizeof (options)); + inet_ntop (AF_INET6, &link_lsa->linklocal_addr, buf, sizeof (buf)); + prefixnum = ntohl (link_lsa->prefix_num); + + zlog_debug (" Priority: %d Options: %s", link_lsa->priority, options); + zlog_debug (" LinkLocal Address: %s", buf); + zlog_debug (" Number of Prefix: %d", prefixnum); + + start = (char *) link_lsa + sizeof (struct ospf6_link_lsa); + end = (char *) lsa->header + ntohs (lsa->header->length); + for (current = start; current < end; current += OSPF6_PREFIX_SIZE (prefix)) + { + prefix = (struct ospf6_prefix *) current; + if (prefix->prefix_length == 0 || + current + OSPF6_PREFIX_SIZE (prefix) > end) + break; + p = (CHECK_FLAG (prefix->prefix_options, OSPF6_PREFIX_OPTION_P) ? + "P" : "--"); + mc = (CHECK_FLAG (prefix->prefix_options, OSPF6_PREFIX_OPTION_MC) ? + "MC" : "--"); + la = (CHECK_FLAG (prefix->prefix_options, OSPF6_PREFIX_OPTION_LA) ? + "LA" : "--"); + nu = (CHECK_FLAG (prefix->prefix_options, OSPF6_PREFIX_OPTION_NU) ? + "NU" : "--"); + zlog_debug (" Prefix Options: %s|%s|%s|%s", p, mc, la, nu); + + memset (&in6, 0, sizeof (in6)); + memcpy (&in6, OSPF6_PREFIX_BODY (prefix), + OSPF6_PREFIX_SPACE (prefix->prefix_length)); + inet_ntop (AF_INET6, &in6, buf, sizeof (buf)); + zlog_debug (" Prefix: %s/%d", buf, prefix->prefix_length); + } + return 0; +} + +int +ospf6_debug_intra_prefix_lsa_show (struct ospf6_lsa *lsa) +{ + char *start, *end, *current; + struct ospf6_intra_prefix_lsa *intra_prefix_lsa; + int prefixnum; + char buf[128]; + struct ospf6_prefix *prefix; + char id[16], adv_router[16]; + const char *p, *mc, *la, *nu; + struct in6_addr in6; + + intra_prefix_lsa = (struct ospf6_intra_prefix_lsa *) + ((caddr_t) lsa->header + sizeof (struct ospf6_lsa_header)); + + prefixnum = ntohs (intra_prefix_lsa->prefix_num); + + zlog_debug (" Number of Prefix: %d", prefixnum); + + inet_ntop (AF_INET, &intra_prefix_lsa->ref_id, id, sizeof (id)); + inet_ntop (AF_INET, &intra_prefix_lsa->ref_adv_router, + adv_router, sizeof (adv_router)); + zlog_debug (" Reference: %s Id: %s Adv: %s", + ospf6_lstype_name (intra_prefix_lsa->ref_type), id, adv_router); + + start = (char *) intra_prefix_lsa + sizeof (struct ospf6_intra_prefix_lsa); + end = (char *) lsa->header + ntohs (lsa->header->length); + for (current = start; current < end; current += OSPF6_PREFIX_SIZE (prefix)) + { + prefix = (struct ospf6_prefix *) current; + if (prefix->prefix_length == 0 || + current + OSPF6_PREFIX_SIZE (prefix) > end) + break; + p = (CHECK_FLAG (prefix->prefix_options, OSPF6_PREFIX_OPTION_P) ? + "P" : "--"); + mc = (CHECK_FLAG (prefix->prefix_options, OSPF6_PREFIX_OPTION_MC) ? + "MC" : "--"); + la = (CHECK_FLAG (prefix->prefix_options, OSPF6_PREFIX_OPTION_LA) ? + "LA" : "--"); + nu = (CHECK_FLAG (prefix->prefix_options, OSPF6_PREFIX_OPTION_NU) ? + "NU" : "--"); + zlog_debug (" Prefix Options: %s|%s|%s|%s", p, mc, la, nu); + + memset (&in6, 0, sizeof (in6)); + memcpy (&in6, OSPF6_PREFIX_BODY (prefix), + OSPF6_PREFIX_SPACE (prefix->prefix_length)); + inet_ntop (AF_INET6, &in6, buf, sizeof (buf)); + zlog_debug (" Prefix: %s/%d", buf, prefix->prefix_length); + } + return 0; +} --- quagga-0.99.9/ospf6d/ospf6_lsdb.h 2004-12-15 09:14:21.000000000 -0800 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_lsdb.h 2008-04-16 11:55:47.000000000 -0700 @@ -25,6 +25,8 @@ #include "prefix.h" #include "table.h" +#include "ospf6_lsa.h" + struct ospf6_lsdb { void *data; /* data structure that holds this lsdb */ @@ -53,12 +55,12 @@ struct ospf6_lsdb struct ospf6_lsdb *ospf6_lsdb_create (void *data); void ospf6_lsdb_delete (struct ospf6_lsdb *lsdb); -struct ospf6_lsa * -ospf6_lsdb_lookup (u_int16_t type, u_int32_t id, u_int32_t adv_router, +struct ospf6_lsa *ospf6_lsdb_lookup (u_int16_t type, u_int32_t id, + u_int32_t adv_router, + struct ospf6_lsdb *lsdb); +struct ospf6_lsa *ospf6_lsdb_lookup_next (u_int16_t type, u_int32_t id, + u_int32_t adv_router, struct ospf6_lsdb *lsdb); -struct ospf6_lsa * -ospf6_lsdb_lookup_next (u_int16_t type, u_int32_t id, - u_int32_t adv_router, struct ospf6_lsdb *lsdb); void ospf6_lsdb_add (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb); void ospf6_lsdb_remove (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb); @@ -93,8 +95,26 @@ void ospf6_lsdb_show u_int32_t ospf6_new_ls_id (u_int16_t type, u_int32_t adv_router, struct ospf6_lsdb *lsdb); u_int32_t ospf6_new_ls_seqnum - (u_int16_t type, u_int32_t id, u_int32_t adv_router, struct ospf6_lsdb *lsdb); - -#endif /* OSPF6_LSDB_H */ + (u_int16_t type, u_int32_t id, u_int32_t adv_router, + struct ospf6_lsdb *lsdb); +/* Debug option */ +extern unsigned char conf_debug_ospf6_database; +#define OSPF6_DEBUG_DATABASE 0x01 +#define OSPF6_DEBUG_DATABASE_DETAIL 0x02 +#define OSPF6_DEBUG_DATABASE_ON(level) \ + (conf_debug_ospf6_database |= (level)) +#define OSPF6_DEBUG_DATABASE_OFF(level) \ + (conf_debug_ospf6_database &= ~(level)) +#define IS_OSPF6_DEBUG_DATABASE(level) \ + (conf_debug_ospf6_database & OSPF6_DEBUG_ ## level) + +void install_element_ospf6_debug_database (); +void ospf6_debug_lsdb_show (int level, struct ospf6_lsdb *lsdb); + +int ospf6_debug_router_lsa_show (struct ospf6_lsa *lsa); +int ospf6_debug_network_lsa_show (struct ospf6_lsa *lsa); +int ospf6_debug_link_lsa_show (struct ospf6_lsa *lsa); +int ospf6_debug_intra_prefix_lsa_show (struct ospf6_lsa *lsa); +#endif /* OSPF6_LSDB_H */ --- quagga-0.99.9/ospf6d/ospf6_main.c 2006-10-15 16:34:48.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_main.c 2008-04-16 11:55:47.000000000 -0700 @@ -44,14 +44,12 @@ #define OSPF6_VTY_PORT 2606 /* ospf6d privileges */ -zebra_capabilities_t _caps_p [] = -{ +zebra_capabilities_t _caps_p[] = { ZCAP_NET_RAW, ZCAP_BIND }; -struct zebra_privs_t ospf6d_privs = -{ +struct zebra_privs_t ospf6d_privs = { #if defined(QUAGGA_USER) .user = QUAGGA_USER, #endif @@ -67,8 +65,7 @@ struct zebra_privs_t ospf6d_privs = }; /* ospf6d options, we use GNU getopt library. */ -struct option longopts[] = -{ +struct option longopts[] = { { "daemon", no_argument, NULL, 'd'}, { "config_file", required_argument, NULL, 'f'}, { "pid_file", required_argument, NULL, 'i'}, @@ -155,8 +153,7 @@ sigusr1 (void) zlog_rotate (NULL); } -struct quagga_signal_t ospf6_signals[] = -{ +struct quagga_signal_t ospf6_signals[] = { { .signal = SIGHUP, .handler = &sighup, @@ -256,8 +253,7 @@ main (int argc, char *argv[], char *envp /* Initializations. */ zlog_default = openzlog (progname, ZLOG_OSPF6, - LOG_CONS|LOG_NDELAY|LOG_PID, - LOG_DAEMON); + LOG_CONS | LOG_NDELAY | LOG_PID, LOG_DAEMON); zprivs_init (&ospf6d_privs); /* initialize zebra libraries */ signal_init (master, Q_SIGC(ospf6_signals), ospf6_signals); --- quagga-0.99.9/ospf6d/ospf6_message.c 2006-05-15 03:43:52.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_message.c 2008-04-16 11:55:47.000000000 -0700 @@ -375,7 +383,8 @@ ospf6_hello_recv (struct in6_addr *src, { if (hello->bdrouter == on->router_id) backupseen++; - else if (hello->drouter == on->router_id && hello->bdrouter == htonl (0)) + else if (hello->drouter == on->router_id + && hello->bdrouter == htonl (0)) backupseen++; } @@ -394,8 +403,7 @@ ospf6_hello_recv (struct in6_addr *src, } static void -ospf6_dbdesc_recv_master (struct ospf6_header *oh, - struct ospf6_neighbor *on) +ospf6_dbdesc_recv_master (struct ospf6_header *oh, struct ospf6_neighbor *on) { struct ospf6_dbdesc *dbdesc; char *p; @@ -605,8 +614,7 @@ ospf6_dbdesc_recv_master (struct ospf6_h } static void -ospf6_dbdesc_recv_slave (struct ospf6_header *oh, - struct ospf6_neighbor *on) +ospf6_dbdesc_recv_slave (struct ospf6_header *oh, struct ospf6_neighbor *on) { struct ospf6_dbdesc *dbdesc; char *p; @@ -842,8 +850,7 @@ ospf6_dbdesc_recv (struct in6_addr *src, if (dbdesc->reserved1 || dbdesc->reserved2) { if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV)) - zlog_debug ("Non-0 reserved field in %s's DbDesc, correct", - on->name); + zlog_debug ("Non-0 reserved field in %s's DbDesc, correct", on->name); dbdesc->reserved1 = 0; dbdesc->reserved2 = 0; } @@ -881,8 +889,7 @@ ospf6_lsreq_recv (struct in6_addr *src, } if (on->state != OSPF6_NEIGHBOR_EXCHANGE && - on->state != OSPF6_NEIGHBOR_LOADING && - on->state != OSPF6_NEIGHBOR_FULL) + on->state != OSPF6_NEIGHBOR_LOADING && on->state != OSPF6_NEIGHBOR_FULL) { if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV)) zlog_debug ("Neighbor state less than Exchange, ignore"); @@ -1020,8 +1027,11 @@ ospf6_lsupdate_recv (struct in6_addr *sr on->state == OSPF6_NEIGHBOR_LOADING)) { THREAD_OFF (on->thread_send_lsreq); - on->thread_send_lsreq = - thread_add_event (master, ospf6_lsreq_send, on, 0); + // this was causing a flood of requests and updates because the + // LSA was not being accepted until after minLSArrival passed + on->thread_send_lsreq = thread_add_timer (master, ospf6_lsreq_send, on, + oi->area->ospf6-> + minLSArrival); } } @@ -1047,8 +1057,7 @@ ospf6_lsack_recv (struct in6_addr *src, } if (on->state != OSPF6_NEIGHBOR_EXCHANGE && - on->state != OSPF6_NEIGHBOR_LOADING && - on->state != OSPF6_NEIGHBOR_FULL) + on->state != OSPF6_NEIGHBOR_LOADING && on->state != OSPF6_NEIGHBOR_FULL) { if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV)) zlog_debug ("Neighbor state less than Exchange, ignore"); @@ -1116,8 +1127,7 @@ ospf6_lsack_recv (struct in6_addr *src, } if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV)) - zlog_debug ("Acknowledged, remove from %s's retrans-list", - on->name); + zlog_debug ("Acknowledged, remove from %s's retrans-list", on->name); ospf6_decrement_retrans_count (mine); if (OSPF6_LSA_IS_MAXAGE (mine)) @@ -1226,7 +1236,8 @@ ospf6_receive (struct thread *thread) zlog_debug (" src: %s", srcname); zlog_debug (" dst: %s", dstname); if (len != ntohs (oh->length)) - zlog_debug ("Message length does not match actually received: %d", len); + zlog_debug ("Message length does not match actually received: %d", + len); switch (oh->type) { @@ -1297,10 +1308,13 @@ ospf6_send (struct in6_addr *src, struct int len; char srcname[64], dstname[64]; struct iovec iovector[2]; + int length; /* initialize */ iovector[0].iov_base = (caddr_t) oh; + length = ntohs (oh->length); // not in original code iovector[0].iov_len = ntohs (oh->length); + iovector[1].iov_base = NULL; iovector[1].iov_len = 0; @@ -1352,11 +1366,16 @@ ospf6_send (struct in6_addr *src, struct } /* send message */ + len = ospf6_sendmsg (src, dst, &oi->interface->ifindex, iovector); if (len != ntohs (oh->length)) - zlog_err ("Could not send entire message"); + zlog_err ("Could not send entire message length %d != %d", oh->length, + len); } + + + int ospf6_hello_send (struct thread *thread) { @@ -1378,13 +1399,18 @@ ospf6_hello_send (struct thread *thread) return 0; } + if (oi->type == OSPF6_IFTYPE_LOOPBACK) + return 0; + + /* set next thread */ oi->thread_send_hello = thread_add_timer (master, ospf6_hello_send, oi, oi->hello_interval); memset (sendbuf, 0, iobuflen); oh = (struct ospf6_header *) sendbuf; - hello = (struct ospf6_hello *)((caddr_t) oh + sizeof (struct ospf6_header)); + hello = + (struct ospf6_hello *) ((caddr_t) oh + sizeof (struct ospf6_header)); hello->interface_id = htonl (oi->interface->ifindex); hello->priority = oi->priority; @@ -1580,7 +1606,8 @@ ospf6_lsreq_send (struct thread *thread) lsa = ospf6_lsdb_next (lsa)) { /* MTU check */ - if (p - sendbuf + sizeof (struct ospf6_lsreq_entry) > on->ospf6_if->ifmtu) + if (p - sendbuf + sizeof (struct ospf6_lsreq_entry) > + on->ospf6_if->ifmtu) { ospf6_lsa_unlock (lsa); break; @@ -1626,8 +1653,7 @@ ospf6_lsupdate_send_neighbor (struct thr } /* if we have nothing to send, return */ - if (on->lsupdate_list->count == 0 && - on->retrans_list->count == 0) + if (on->lsupdate_list->count == 0 && on->retrans_list->count == 0) { if (IS_OSPF6_DEBUG_MESSAGE (OSPF6_MESSAGE_TYPE_LSUPDATE, SEND)) zlog_debug ("Quit to send (nothing to send)"); @@ -1689,8 +1715,7 @@ ospf6_lsupdate_send_neighbor (struct thr ospf6_send (on->ospf6_if->linklocal_addr, &on->linklocal_addr, on->ospf6_if, oh); - if (on->lsupdate_list->count != 0 || - on->retrans_list->count != 0) + if (on->lsupdate_list->count != 0 || on->retrans_list->count != 0) { if (on->lsupdate_list->count != 0) on->thread_send_lsupdate = @@ -1721,7 +1746,8 @@ ospf6_lsupdate_send_interface (struct th { if (IS_OSPF6_DEBUG_MESSAGE (OSPF6_MESSAGE_TYPE_LSUPDATE, SEND)) zlog_debug ("Quit to send LSUpdate to interface %s state %s", - oi->interface->name, ospf6_interface_state_str[oi->state]); + oi->interface->name, + ospf6_interface_state_str[oi->state]); return 0; } @@ -1762,8 +1788,14 @@ ospf6_lsupdate_send_interface (struct th oh->type = OSPF6_MESSAGE_TYPE_LSUPDATE; oh->length = htons (p - sendbuf); - if (oi->state == OSPF6_INTERFACE_DR || - oi->state == OSPF6_INTERFACE_BDR) + if (oi->type == OSPF6_IFTYPE_BROADCAST || oi->type == OSPF6_IFTYPE_NBMA) + { + if (oi->state == OSPF6_INTERFACE_DR || oi->state == OSPF6_INTERFACE_BDR) + ospf6_send (oi->linklocal_addr, &allspfrouters6, oi, oh); + else + ospf6_send (oi->linklocal_addr, &alldrouters6, oi, oh); + } + else if (oi->type == OSPF6_IFTYPE_POINTOMULTIPOINT) ospf6_send (oi->linklocal_addr, &allspfrouters6, oi, oh); else ospf6_send (oi->linklocal_addr, &alldrouters6, oi, oh); @@ -1809,7 +1841,8 @@ ospf6_lsack_send_neighbor (struct thread lsa = ospf6_lsdb_next (lsa)) { /* MTU check */ - if (p - sendbuf + sizeof (struct ospf6_lsa_header) > on->ospf6_if->ifmtu) + if (p - sendbuf + sizeof (struct ospf6_lsa_header) > + on->ospf6_if->ifmtu) { /* if we run out of packet size/space here, better to try again soon. */ @@ -1852,7 +1885,8 @@ ospf6_lsack_send_interface (struct threa { if (IS_OSPF6_DEBUG_MESSAGE (OSPF6_MESSAGE_TYPE_LSACK, SEND)) zlog_debug ("Quit to send LSAck to interface %s state %s", - oi->interface->name, ospf6_interface_state_str[oi->state]); + oi->interface->name, + ospf6_interface_state_str[oi->state]); return 0; } @@ -1892,11 +1926,15 @@ ospf6_lsack_send_interface (struct threa oh->type = OSPF6_MESSAGE_TYPE_LSACK; oh->length = htons (p - sendbuf); - if (oi->state == OSPF6_INTERFACE_DR || - oi->state == OSPF6_INTERFACE_BDR) + if (oi->type == OSPF6_IFTYPE_BROADCAST || oi->type == OSPF6_IFTYPE_NBMA) + { + if (oi->state == OSPF6_INTERFACE_DR || oi->state == OSPF6_INTERFACE_BDR) ospf6_send (oi->linklocal_addr, &allspfrouters6, oi, oh); else ospf6_send (oi->linklocal_addr, &alldrouters6, oi, oh); + } + else + ospf6_send (oi->linklocal_addr, &allspfrouters6, oi, oh); if (oi->thread_send_lsack == NULL && oi->lsack_list->count > 0) { @@ -1907,7 +1945,6 @@ ospf6_lsack_send_interface (struct threa return 0; } - /* Commands */ DEFUN (debug_ospf6_message, debug_ospf6_message_cmd, @@ -1920,9 +1957,7 @@ DEFUN (debug_ospf6_message, "Debug Database Description message\n" "Debug Link State Request message\n" "Debug Link State Update message\n" - "Debug Link State Acknowledgement message\n" - "Debug All message\n" - ) + "Debug Link State Acknowledgement message\n" "Debug All message\n") { unsigned char level = 0; int type = 0; @@ -1977,9 +2012,7 @@ ALIAS (debug_ospf6_message, "Debug Link State Update message\n" "Debug Link State Acknowledgement message\n" "Debug All message\n" - "Debug only sending message\n" - "Debug only receiving message\n" - ); + "Debug only sending message\n" "Debug only receiving message\n"); DEFUN (no_debug_ospf6_message, @@ -1994,9 +2027,7 @@ DEFUN (no_debug_ospf6_message, "Debug Database Description message\n" "Debug Link State Request message\n" "Debug Link State Update message\n" - "Debug Link State Acknowledgement message\n" - "Debug All message\n" - ) + "Debug Link State Acknowledgement message\n" "Debug All message\n") { unsigned char level = 0; int type = 0; @@ -2053,15 +2084,14 @@ ALIAS (no_debug_ospf6_message, "Debug Link State Update message\n" "Debug Link State Acknowledgement message\n" "Debug All message\n" - "Debug only sending message\n" - "Debug only receiving message\n" - ); + "Debug only sending message\n" "Debug only receiving message\n"); int config_write_ospf6_debug_message (struct vty *vty) { const char *type_str[] = {"unknown", "hello", "dbdesc", - "lsreq", "lsupdate", "lsack"}; + "lsreq", "lsupdate", "lsack" + }; unsigned char s = 0, r = 0; int i; @@ -2105,11 +2135,9 @@ config_write_ospf6_debug_message (struct IS_OSPF6_DEBUG_MESSAGE (i, RECV)) vty_out (vty, "debug ospf6 message %s%s", type_str[i], VNL); else if (IS_OSPF6_DEBUG_MESSAGE (i, SEND)) - vty_out (vty, "debug ospf6 message %s send%s", type_str[i], - VNL); + vty_out (vty, "debug ospf6 message %s send%s", type_str[i], VNL); else if (IS_OSPF6_DEBUG_MESSAGE (i, RECV)) - vty_out (vty, "debug ospf6 message %s recv%s", type_str[i], - VNL); + vty_out (vty, "debug ospf6 message %s recv%s", type_str[i], VNL); } return 0; --- quagga-0.99.9/ospf6d/ospf6_message.h 2004-10-11 09:21:34.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_message.h 2008-04-16 11:55:47.000000000 -0700 @@ -137,5 +144,11 @@ int ospf6_lsack_send_neighbor (struct th int config_write_ospf6_debug_message (struct vty *); void install_element_ospf6_debug_message (); -#endif /* OSPF6_MESSAGE_H */ + + + + + + +#endif /* OSPF6_MESSAGE_H */ --- quagga-0.99.9/ospf6d/ospf6_neighbor.c 2007-03-08 09:47:47.000000000 -0800 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_neighbor.c 2008-04-16 11:55:47.000000000 -0700 @@ -39,12 +39,14 @@ #include "ospf6_intra.h" #include "ospf6_flood.h" #include "ospf6d.h" +#include "ospf6d.h" unsigned char conf_debug_ospf6_neighbor = 0; const char *ospf6_neighbor_state_str[] = { "None", "Down", "Attempt", "Init", "Twoway", "ExStart", "ExChange", - "Loading", "Full", NULL }; + "Loading", "Full", NULL +}; int ospf6_neighbor_cmp (void *va, void *vb) @@ -55,8 +57,7 @@ ospf6_neighbor_cmp (void *va, void *vb) } struct ospf6_neighbor * -ospf6_neighbor_lookup (u_int32_t router_id, - struct ospf6_interface *oi) +ospf6_neighbor_lookup (u_int32_t router_id, struct ospf6_interface *oi) { struct listnode *n; struct ospf6_neighbor *on; @@ -85,8 +87,7 @@ ospf6_neighbor_create (u_int32_t router_ memset (on, 0, sizeof (struct ospf6_neighbor)); inet_ntop (AF_INET, &router_id, buf, sizeof (buf)); - snprintf (on->name, sizeof (on->name), "%s%%%s", - buf, oi->interface->name); + snprintf (on->name, sizeof (on->name), "%s%%%s", buf, oi->interface->name); on->ospf6_if = oi; on->state = OSPF6_NEIGHBOR_DOWN; gettimeofday (&on->last_changed, (struct timezone *) NULL); @@ -143,7 +147,8 @@ ospf6_neighbor_delete (struct ospf6_neig XFREE (MTYPE_OSPF6_NEIGHBOR, on); } -static void +static + void ospf6_neighbor_state_change (u_char next_state, struct ospf6_neighbor *on) { u_char prev_state; @@ -399,8 +410,7 @@ adj_ok (struct thread *thread) thread_add_event (master, ospf6_dbdesc_send, on, 0); } - else if (on->state >= OSPF6_NEIGHBOR_EXSTART && - ! need_adjacency (on)) + else if (on->state >= OSPF6_NEIGHBOR_EXSTART && !need_adjacency (on)) { ospf6_neighbor_state_change (OSPF6_NEIGHBOR_TWOWAY, on); ospf6_lsdb_remove_all (on->summary_list); @@ -547,8 +558,6 @@ inactivity_timer (struct thread *thread) return 0; } - - /* vty functions */ /* show neighbor structure */ void @@ -574,7 +583,8 @@ ospf6_neighbor_show (struct vty *vty, st h = m = s = 0; if (on->inactivity_timer) { - s = on->inactivity_timer->u.sands.tv_sec - recent_relative_time().tv_sec; + s = + on->inactivity_timer->u.sands.tv_sec - recent_relative_time ().tv_sec; h = s / 3600; s -= h * 3600; m = s / 60; @@ -583,7 +593,8 @@ ospf6_neighbor_show (struct vty *vty, st snprintf (deadtime, sizeof (deadtime), "%02ld:%02ld:%02ld", h, m, s); /* Neighbor State */ - if (if_is_pointopoint (on->ospf6_if->interface)) + if (on->ospf6_if->type == OSPF6_IFTYPE_POINTOMULTIPOINT || + on->ospf6_if->type == OSPF6_IFTYPE_POINTOPOINT) snprintf (nstate, sizeof (nstate), "PointToPoint"); else { @@ -637,8 +648,7 @@ ospf6_neighbor_show_drchoice (struct vty vty_out (vty, "%-15s %6s/%-11s %-15s %-15s %s[%s]%s", router_id, ospf6_neighbor_state_str[on->state], duration, drouter, bdrouter, on->ospf6_if->interface->name, - ospf6_interface_state_str[on->ospf6_if->state], - VNL); + ospf6_interface_state_str[on->ospf6_if->state], VNL); } void @@ -658,43 +668,36 @@ ospf6_neighbor_show_detail (struct vty * timersub (&now, &on->last_changed, &res); timerstring (&res, duration, sizeof (duration)); - vty_out (vty, " Neighbor %s%s", on->name, - VNL); + vty_out (vty, " Neighbor %s%s", on->name, VNL); vty_out (vty, " Area %s via interface %s (ifindex %d)%s", on->ospf6_if->area->name, on->ospf6_if->interface->name, - on->ospf6_if->interface->ifindex, - VNL); + on->ospf6_if->interface->ifindex, VNL); vty_out (vty, " His IfIndex: %d Link-local address: %s%s", - on->ifindex, linklocal_addr, - VNL); + on->ifindex, linklocal_addr, VNL); vty_out (vty, " State %s for a duration of %s%s", - ospf6_neighbor_state_str[on->state], duration, - VNL); + ospf6_neighbor_state_str[on->state], duration, VNL); vty_out (vty, " His choice of DR/BDR %s/%s, Priority %d%s", - drouter, bdrouter, on->priority, - VNL); + drouter, bdrouter, on->priority, VNL); vty_out (vty, " DbDesc status: %s%s%s SeqNum: %#lx%s", - (CHECK_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT) ? "Initial " : ""), - (CHECK_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT) ? "More " : ""), - (CHECK_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT) ? - "Master" : "Slave"), (u_long) ntohl (on->dbdesc_seqnum), - VNL); + (CHECK_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT) ? "Initial " : + ""), (CHECK_FLAG (on->dbdesc_bits, + OSPF6_DBDESC_MBIT) ? "More " : ""), + (CHECK_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT) ? "Master" : + "Slave"), (u_long) ntohl (on->dbdesc_seqnum), VNL); - vty_out (vty, " Summary-List: %d LSAs%s", on->summary_list->count, - VNL); + + vty_out (vty, " Summary-List: %d LSAs%s", on->summary_list->count, VNL); for (lsa = ospf6_lsdb_head (on->summary_list); lsa; lsa = ospf6_lsdb_next (lsa)) vty_out (vty, " %s%s", lsa->name, VNL); - vty_out (vty, " Request-List: %d LSAs%s", on->request_list->count, - VNL); + vty_out (vty, " Request-List: %d LSAs%s", on->request_list->count, VNL); for (lsa = ospf6_lsdb_head (on->request_list); lsa; lsa = ospf6_lsdb_next (lsa)) vty_out (vty, " %s%s", lsa->name, VNL); - vty_out (vty, " Retrans-List: %d LSAs%s", on->retrans_list->count, - VNL); + vty_out (vty, " Retrans-List: %d LSAs%s", on->retrans_list->count, VNL); for (lsa = ospf6_lsdb_head (on->retrans_list); lsa; lsa = ospf6_lsdb_next (lsa)) vty_out (vty, " %s%s", lsa->name, VNL); @@ -705,8 +708,7 @@ ospf6_neighbor_show_detail (struct vty * timerstring (&res, duration, sizeof (duration)); vty_out (vty, " %d Pending LSAs for DbDesc in Time %s [thread %s]%s", on->dbdesc_list->count, duration, - (on->thread_send_dbdesc ? "on" : "off"), - VNL); + (on->thread_send_dbdesc ? "on" : "off"), VNL); for (lsa = ospf6_lsdb_head (on->dbdesc_list); lsa; lsa = ospf6_lsdb_next (lsa)) vty_out (vty, " %s%s", lsa->name, VNL); @@ -717,8 +719,7 @@ ospf6_neighbor_show_detail (struct vty * timerstring (&res, duration, sizeof (duration)); vty_out (vty, " %d Pending LSAs for LSReq in Time %s [thread %s]%s", on->lsreq_list->count, duration, - (on->thread_send_lsreq ? "on" : "off"), - VNL); + (on->thread_send_lsreq ? "on" : "off"), VNL); for (lsa = ospf6_lsdb_head (on->lsreq_list); lsa; lsa = ospf6_lsdb_next (lsa)) vty_out (vty, " %s%s", lsa->name, VNL); @@ -729,8 +730,7 @@ ospf6_neighbor_show_detail (struct vty * timerstring (&res, duration, sizeof (duration)); vty_out (vty, " %d Pending LSAs for LSUpdate in Time %s [thread %s]%s", on->lsupdate_list->count, duration, - (on->thread_send_lsupdate ? "on" : "off"), - VNL); + (on->thread_send_lsupdate ? "on" : "off"), VNL); for (lsa = ospf6_lsdb_head (on->lsupdate_list); lsa; lsa = ospf6_lsdb_next (lsa)) vty_out (vty, " %s%s", lsa->name, VNL); @@ -741,8 +741,7 @@ ospf6_neighbor_show_detail (struct vty * timerstring (&res, duration, sizeof (duration)); vty_out (vty, " %d Pending LSAs for LSAck in Time %s [thread %s]%s", on->lsack_list->count, duration, - (on->thread_send_lsack ? "on" : "off"), - VNL); + (on->thread_send_lsack ? "on" : "off"), VNL); for (lsa = ospf6_lsdb_head (on->lsack_list); lsa; lsa = ospf6_lsdb_next (lsa)) vty_out (vty, " %s%s", lsa->name, VNL); @@ -752,11 +751,7 @@ ospf6_neighbor_show_detail (struct vty * DEFUN (show_ipv6_ospf6_neighbor, show_ipv6_ospf6_neighbor_cmd, "show ipv6 ospf6 neighbor", - SHOW_STR - IP6_STR - OSPF6_STR - "Neighbor list\n" - ) + SHOW_STR IP6_STR OSPF6_STR "Neighbor list\n") { struct ospf6_neighbor *on; struct ospf6_interface *oi; @@ -798,10 +793,7 @@ ALIAS (show_ipv6_ospf6_neighbor, SHOW_STR IP6_STR OSPF6_STR - "Neighbor list\n" - "Display details\n" - "Display DR choices\n" - ); + "Neighbor list\n" "Display details\n" "Display DR choices\n"); DEFUN (show_ipv6_ospf6_neighbor_one, show_ipv6_ospf6_neighbor_one_cmd, @@ -809,9 +801,7 @@ DEFUN (show_ipv6_ospf6_neighbor_one, SHOW_STR IP6_STR OSPF6_STR - "Neighbor list\n" - "Specify Router-ID as IPv4 address notation\n" - ) + "Neighbor list\n" "Specify Router-ID as IPv4 address notation\n") { struct ospf6_neighbor *on; struct ospf6_interface *oi; @@ -825,8 +815,7 @@ DEFUN (show_ipv6_ospf6_neighbor_one, if ((inet_pton (AF_INET, argv[0], &router_id)) != 1) { - vty_out (vty, "Router-ID is not parsable: %s%s", argv[0], - VNL); + vty_out (vty, "Router-ID is not parsable: %s%s", argv[0], VNL); return CMD_SUCCESS; } @@ -849,11 +838,7 @@ ospf6_neighbor_init () DEFUN (debug_ospf6_neighbor, debug_ospf6_neighbor_cmd, - "debug ospf6 neighbor", - DEBUG_STR - OSPF6_STR - "Debug OSPFv3 Neighbor\n" - ) + "debug ospf6 neighbor", DEBUG_STR OSPF6_STR "Debug OSPFv3 Neighbor\n") { unsigned char level = 0; if (argc) @@ -877,17 +862,12 @@ ALIAS (debug_ospf6_neighbor, OSPF6_STR "Debug OSPFv3 Neighbor\n" "Debug OSPFv3 Neighbor State Change\n" - "Debug OSPFv3 Neighbor Event\n" - ); + "Debug OSPFv3 Neighbor Event\n"); DEFUN (no_debug_ospf6_neighbor, no_debug_ospf6_neighbor_cmd, "no debug ospf6 neighbor", - NO_STR - DEBUG_STR - OSPF6_STR - "Debug OSPFv3 Neighbor\n" - ) + NO_STR DEBUG_STR OSPF6_STR "Debug OSPFv3 Neighbor\n") { unsigned char level = 0; if (argc) @@ -912,14 +892,12 @@ ALIAS (no_debug_ospf6_neighbor, OSPF6_STR "Debug OSPFv3 Neighbor\n" "Debug OSPFv3 Neighbor State Change\n" - "Debug OSPFv3 Neighbor Event\n" - ); + "Debug OSPFv3 Neighbor Event\n"); int config_write_ospf6_debug_neighbor (struct vty *vty) { - if (IS_OSPF6_DEBUG_NEIGHBOR (STATE) && - IS_OSPF6_DEBUG_NEIGHBOR (EVENT)) + if (IS_OSPF6_DEBUG_NEIGHBOR (STATE) && IS_OSPF6_DEBUG_NEIGHBOR (EVENT)) vty_out (vty, "debug ospf6 neighbor%s", VNL); else if (IS_OSPF6_DEBUG_NEIGHBOR (STATE)) vty_out (vty, "debug ospf6 neighbor state%s", VNL); --- quagga-0.99.9/ospf6d/ospf6_neighbor.h 2004-10-11 09:21:34.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_neighbor.h 2008-04-16 11:55:47.000000000 -0700 @@ -107,7 +116,6 @@ struct ospf6_neighbor const extern char *ospf6_neighbor_state_str[]; - /* Function Prototypes */ int ospf6_neighbor_cmp (void *va, void *vb); void ospf6_neighbor_dbex_init (struct ospf6_neighbor *on); @@ -134,5 +142,8 @@ void ospf6_neighbor_init (); int config_write_ospf6_debug_neighbor (struct vty *vty); void install_element_ospf6_debug_neighbor (); -#endif /* OSPF6_NEIGHBOR_H */ + + + +#endif /* OSPF6_NEIGHBOR_H */ --- quagga-0.99.9/ospf6d/ospf6_network.c 2006-05-15 03:43:52.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_network.c 2008-04-16 11:55:47.000000000 -0700 @@ -70,7 +72,8 @@ ospf6_set_checksum () #ifndef DISABLE_IPV6_CHECKSUM if (setsockopt (ospf6_sock, IPPROTO_IPV6, IPV6_CHECKSUM, &offset, sizeof (offset)) < 0) - zlog_warn ("Network: set IPV6_CHECKSUM failed: %s", safe_strerror (errno)); + zlog_warn ("Network: set IPV6_CHECKSUM failed: %s", + safe_strerror (errno)); #else zlog_warn ("Network: Don't set IPV6_CHECKSUM"); #endif /* DISABLE_IPV6_CHECKSUM */ @@ -119,8 +123,7 @@ ospf6_join_allspfrouters (u_int ifindex) assert (ifindex); mreq6.ipv6mr_interface = ifindex; - memcpy (&mreq6.ipv6mr_multiaddr, &allspfrouters6, - sizeof (struct in6_addr)); + memcpy (&mreq6.ipv6mr_multiaddr, &allspfrouters6, sizeof (struct in6_addr)); retval = setsockopt (ospf6_sock, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq6, sizeof (mreq6)); @@ -141,8 +144,7 @@ ospf6_leave_allspfrouters (u_int ifindex assert (ifindex); mreq6.ipv6mr_interface = ifindex; - memcpy (&mreq6.ipv6mr_multiaddr, &allspfrouters6, - sizeof (struct in6_addr)); + memcpy (&mreq6.ipv6mr_multiaddr, &allspfrouters6, sizeof (struct in6_addr)); if (setsockopt (ospf6_sock, IPPROTO_IPV6, IPV6_LEAVE_GROUP, &mreq6, sizeof (mreq6)) < 0) @@ -161,8 +163,7 @@ ospf6_join_alldrouters (u_int ifindex) assert (ifindex); mreq6.ipv6mr_interface = ifindex; - memcpy (&mreq6.ipv6mr_multiaddr, &alldrouters6, - sizeof (struct in6_addr)); + memcpy (&mreq6.ipv6mr_multiaddr, &alldrouters6, sizeof (struct in6_addr)); if (setsockopt (ospf6_sock, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq6, sizeof (mreq6)) < 0) @@ -181,8 +182,7 @@ ospf6_leave_alldrouters (u_int ifindex) assert (ifindex); mreq6.ipv6mr_interface = ifindex; - memcpy (&mreq6.ipv6mr_multiaddr, &alldrouters6, - sizeof (struct in6_addr)); + memcpy (&mreq6.ipv6mr_multiaddr, &alldrouters6, sizeof (struct in6_addr)); if (setsockopt (ospf6_sock, IPPROTO_IPV6, IPV6_LEAVE_GROUP, &mreq6, sizeof (mreq6)) < 0) --- quagga-0.99.9/ospf6d/ospf6_proto.h 2004-09-29 18:37:29.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_proto.h 2008-04-16 11:55:47.000000000 -0700 @@ -77,7 +79,8 @@ struct ospf6_prefix { u_int8_t prefix_length; u_int8_t prefix_options; - union { + union + { u_int16_t _prefix_metric; u_int16_t _prefix_referenced_lstype; } u; @@ -88,6 +91,9 @@ struct ospf6_prefix #define OSPF6_PREFIX_OPTION_NU (1 << 0) /* No Unicast */ #define OSPF6_PREFIX_OPTION_LA (1 << 1) /* Local Address */ + /* AF draft 05 Sec 2.4 + MC bit is not used in other AF's introduced in this document. + */ #define OSPF6_PREFIX_OPTION_MC (1 << 2) /* MultiCast */ #define OSPF6_PREFIX_OPTION_P (1 << 3) /* Propagate (NSSA) */ --- quagga-0.99.9/ospf6d/ospf6_route.c 2006-05-15 03:43:52.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_route.c 2008-04-16 11:55:47.000000000 -0700 @@ -72,16 +72,13 @@ ospf6_route_table_name (struct ospf6_rou switch (table->table_type) { case OSPF6_TABLE_TYPE_SPF_RESULTS: - snprintf (name, sizeof (name), - "area %s spf table", oa->name); + snprintf (name, sizeof (name), "area %s spf table", oa->name); break; case OSPF6_TABLE_TYPE_ROUTES: - snprintf (name, sizeof (name), - "area %s route table", oa->name); + snprintf (name, sizeof (name), "area %s route table", oa->name); break; case OSPF6_TABLE_TYPE_PREFIX_RANGES: - snprintf (name, sizeof (name), - "area %s range table", oa->name); + snprintf (name, sizeof (name), "area %s range table", oa->name); break; case OSPF6_TABLE_TYPE_SUMMARY_PREFIXES: snprintf (name, sizeof (name), @@ -92,8 +89,7 @@ ospf6_route_table_name (struct ospf6_rou "area %s summary router table", oa->name); break; default: - snprintf (name, sizeof (name), - "area %s unknown table", oa->name); + snprintf (name, sizeof (name), "area %s unknown table", oa->name); break; } } @@ -259,8 +255,7 @@ ospf6_route_cmp (struct ospf6_route *ra, } struct ospf6_route * -ospf6_route_lookup (struct prefix *prefix, - struct ospf6_route_table *table) +ospf6_route_lookup (struct prefix *prefix, struct ospf6_route_table *table) { struct route_node *node; struct ospf6_route *route; @@ -351,10 +347,8 @@ route_table_assert (struct ospf6_route_t #else #define ospf6_route_table_assert(t) ((void) 0) #endif /*NDEBUG*/ - struct ospf6_route * -ospf6_route_add (struct ospf6_route *route, - struct ospf6_route_table *table) +ospf6_route_add (struct ospf6_route *route, struct ospf6_route_table *table) { struct route_node *node, *nextnode, *prevnode; struct ospf6_route *current = NULL; @@ -424,8 +418,7 @@ ospf6_route_add (struct ospf6_route *rou zlog_debug ("%s %p: route add %p: update of %p", ospf6_route_table_name (table), table, route, old); else if (IS_OSPF6_DEBUG_ROUTE (TABLE)) - zlog_debug ("%s: route add: update", - ospf6_route_table_name (table)); + zlog_debug ("%s: route add: update", ospf6_route_table_name (table)); /* replace old one if exists */ if (node->info == old) @@ -527,9 +520,11 @@ ospf6_route_add (struct ospf6_route *rou /* lookup real existing next route */ nextnode = node; route_lock_node (nextnode); - do { + do + { nextnode = route_next (nextnode); - } while (nextnode && nextnode->info == NULL); + } + while (nextnode && nextnode->info == NULL); /* set next link */ if (nextnode == NULL) @@ -546,9 +541,11 @@ ospf6_route_add (struct ospf6_route *rou /* lookup real existing prev route */ prevnode = node; route_lock_node (prevnode); - do { + do + { prevnode = route_prev (prevnode); - } while (prevnode && prevnode->info == NULL); + } + while (prevnode && prevnode->info == NULL); /* set prev link */ if (prevnode == NULL) @@ -739,8 +736,7 @@ ospf6_route_match_head (struct prefix *p } struct ospf6_route * -ospf6_route_match_next (struct prefix *prefix, - struct ospf6_route *route) +ospf6_route_match_next (struct prefix *prefix, struct ospf6_route *route) { struct ospf6_route *next; @@ -807,8 +803,7 @@ ospf6_route_show (struct vty *vty, struc prefix2str (&route->prefix, destination, sizeof (destination)); /* nexthop */ - inet_ntop (AF_INET6, &route->nexthop[0].address, nexthop, - sizeof (nexthop)); + inet_ntop (AF_INET6, &route->nexthop[0].address, nexthop, sizeof (nexthop)); if (! if_indextoname (route->nexthop[0].ifindex, ifname)) snprintf (ifname, sizeof (ifname), "%d", route->nexthop[0].ifindex); @@ -856,8 +851,7 @@ ospf6_route_show_detail (struct vty *vty /* destination type */ vty_out (vty, "Destination type: %s%s", - OSPF6_DEST_TYPE_NAME (route->type), - VNL); + OSPF6_DEST_TYPE_NAME (route->type), VNL); /* Time */ timersub (&now, &route->installed, &res); @@ -873,8 +867,7 @@ ospf6_route_show_detail (struct vty *vty (CHECK_FLAG (route->flag, OSPF6_ROUTE_BEST) ? "B" : "-"), (CHECK_FLAG (route->flag, OSPF6_ROUTE_ADD) ? "A" : "-"), (CHECK_FLAG (route->flag, OSPF6_ROUTE_REMOVE) ? "R" : "-"), - (CHECK_FLAG (route->flag, OSPF6_ROUTE_CHANGE) ? "C" : "-"), - VNL); + (CHECK_FLAG (route->flag, OSPF6_ROUTE_CHANGE) ? "C" : "-"), VNL); vty_out (vty, "Memory: prev: %p this: %p next: %p%s", route->prev, route, route->next, VNL); @@ -893,8 +886,7 @@ ospf6_route_show_detail (struct vty *vty inet_ntop (AF_INET, &route->path.origin.adv_router, adv_router, sizeof (adv_router)); vty_out (vty, "LS Origin: %s Id: %s Adv: %s%s", - ospf6_lstype_name (route->path.origin.type), - id, adv_router, VNL); + ospf6_lstype_name (route->path.origin.type), id, adv_router, VNL); /* Options */ ospf6_options_printbuf (route->path.options, options, sizeof (options)); @@ -908,8 +900,7 @@ ospf6_route_show_detail (struct vty *vty vty_out (vty, "Prefix Options: xxx%s", VNL); /* Metrics */ - vty_out (vty, "Metric Type: %d%s", route->path.metric_type, - VNL); + vty_out (vty, "Metric Type: %d%s", route->path.metric_type, VNL); vty_out (vty, "Metric: %d (%d)%s", route->path.cost, route->path.cost_e2, VNL); @@ -1344,8 +1335,7 @@ DEFUN (debug_ospf6_route, "Debug route table calculation\n" "Debug detail\n" "Debug intra-area route calculation\n" - "Debug inter-area route calculation\n" - ) + "Debug inter-area route calculation\n") { unsigned char level = 0; --- quagga-0.99.9/ospf6d/ospf6_route.h 2006-05-15 03:43:53.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_route.h 2008-04-16 11:55:47.000000000 -0700 @@ -257,21 +260,20 @@ struct ospf6_route *ospf6_route_copy (st void ospf6_route_lock (struct ospf6_route *route); void ospf6_route_unlock (struct ospf6_route *route); -struct ospf6_route * -ospf6_route_lookup (struct prefix *prefix, +struct ospf6_route *ospf6_route_lookup (struct prefix *prefix, struct ospf6_route_table *table); -struct ospf6_route * -ospf6_route_lookup_identical (struct ospf6_route *route, +struct ospf6_route *ospf6_route_lookup_identical (struct ospf6_route *route, + struct ospf6_route_table + *table); +struct ospf6_route *ospf6_route_lookup_bestmatch (struct prefix *prefix, + struct ospf6_route_table + *table); + +struct ospf6_route *ospf6_route_add (struct ospf6_route *route, struct ospf6_route_table *table); -struct ospf6_route * -ospf6_route_lookup_bestmatch (struct prefix *prefix, +void ospf6_route_remove (struct ospf6_route *route, struct ospf6_route_table *table); -struct ospf6_route * -ospf6_route_add (struct ospf6_route *route, struct ospf6_route_table *table); -void -ospf6_route_remove (struct ospf6_route *route, struct ospf6_route_table *table); - struct ospf6_route *ospf6_route_head (struct ospf6_route_table *table); struct ospf6_route *ospf6_route_next (struct ospf6_route *route); struct ospf6_route *ospf6_route_best_next (struct ospf6_route *route); --- quagga-0.99.9/ospf6d/ospf6_snmp.c 2007-04-29 05:40:40.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_snmp.c 2008-04-16 11:55:47.000000000 -0700 @@ -114,9 +114,7 @@ #define STRING ASN_OCTET_STR /* For return values e.g. SNMP_INTEGER macro */ -SNMP_LOCAL_VARIABLES - -static struct in_addr tmp; +SNMP_LOCAL_VARIABLES static struct in_addr tmp; #define INT32_INADDR(x) \ (tmp.s_addr = (x), tmp) @@ -131,8 +129,7 @@ static u_char *ospfv3GeneralGroup (); static u_char *ospfv3AreaEntry (); static u_char *ospfv3AreaLsdbEntry (); -struct variable ospfv3_variables[] = -{ +struct variable ospfv3_variables[] = { /* OSPF general variables */ {OSPFv3ROUTERID, IPADDRESS, RWRITE, ospfv3GeneralGroup, 3, {1, 1, 1}}, @@ -202,7 +199,8 @@ struct variable ospfv3_variables[] = 4, {1, 2, 1, 11}}, {OSPFv3AREANSSATRANSLATORSTATE, INTEGER, RONLY, ospfv3AreaEntry, 4, {1, 2, 1, 12}}, - {OSPFv3AREANSSATRANSLATORSTABILITYINTERVAL, INTEGER, RWRITE, ospfv3AreaEntry, + {OSPFv3AREANSSATRANSLATORSTABILITYINTERVAL, INTEGER, RWRITE, + ospfv3AreaEntry, 4, {1, 2, 1, 13}}, {OSPFv3AREANSSATRANSLATOREVENTS, COUNTER, RONLY, ospfv3AreaEntry, 4, {1, 2, 1, 14}}, --- quagga-0.99.9/ospf6d/ospf6_spf.c 2005-04-05 01:45:16.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_spf.c 2008-04-16 11:55:47.000000000 -0700 @@ -41,6 +41,10 @@ #include "ospf6_interface.h" #include "ospf6d.h" + + +#include "ospf6_proto.h" + unsigned char conf_debug_ospf6_spf = 0; int @@ -284,8 +288,7 @@ ospf6_spf_install (struct ospf6_vertex * struct listnode *node, *nnode; if (IS_OSPF6_DEBUG_SPF (PROCESS)) - zlog_debug ("SPF install %s hops %d cost %d", - v->name, v->hops, v->cost); + zlog_debug ("SPF install %s hops %d cost %d", v->name, v->hops, v->cost); route = ospf6_route_lookup (&v->vertex_id, result_table); if (route && route->path.cost < v->cost) @@ -331,8 +334,9 @@ ospf6_spf_install (struct ospf6_vertex * listnode_delete (prev->parent->child_list, prev); listnode_add_sort (v->parent->child_list, v); - ospf6_vertex_delete (prev); + //ospf6_vertex_delete (prev); //HACK route->route_option = v; + } else ospf6_vertex_delete (v); @@ -414,8 +418,17 @@ ospf6_spf_calculation (u_int32_t router_ /* construct root vertex */ lsa = ospf6_lsdb_lookup (htons (OSPF6_LSTYPE_ROUTER), htonl (0), router_id, oa->lsdb); + //The router should not use a maxaged LSA as the root. A maxaged LSA + //should be treated as NULL + if ((lsa != NULL) && OSPF6_LSA_IS_MAXAGE (lsa)) + lsa = NULL; + if (lsa == NULL) + { + //candidate list was not being deleted when returning on NULL + pqueue_delete (candidate_list); return; + } root = ospf6_vertex_create (lsa); root->area = oa; root->cost = 0; @@ -436,6 +450,14 @@ ospf6_spf_calculation (u_int32_t router_ if (ospf6_spf_install (v, result_table) < 0) continue; + // Except for the case of fully connected adjacencies and full LSAs, + // the appropriate neighbors of the root have already been added + // to candidate list. + if (v == root && oi->type == OSPF6_IFTYPE_MDR && + !(oi->AdjConnectivity == OSPF6_ADJ_FULLYCONNECTED && + oi->LSAFullness == OSPF6_LSA_FULLNESS_FULL)) + continue; + /* For each LS description in the just-added vertex V's LSA */ size = (VERTEX_IS_TYPE (ROUTER, v) ? sizeof (struct ospf6_router_lsdesc) : @@ -587,10 +611,7 @@ DEFUN (debug_ospf6_spf_process, debug_ospf6_spf_process_cmd, "debug ospf6 spf process", DEBUG_STR - OSPF6_STR - "Debug SPF Calculation\n" - "Debug Detailed SPF Process\n" - ) + OSPF6_STR "Debug SPF Calculation\n" "Debug Detailed SPF Process\n") { unsigned char level = 0; level = OSPF6_DEBUG_SPF_PROCESS; @@ -603,9 +624,7 @@ DEFUN (debug_ospf6_spf_time, "debug ospf6 spf time", DEBUG_STR OSPF6_STR - "Debug SPF Calculation\n" - "Measure time taken by SPF Calculation\n" - ) + "Debug SPF Calculation\n" "Measure time taken by SPF Calculation\n") { unsigned char level = 0; level = OSPF6_DEBUG_SPF_TIME; @@ -619,8 +638,7 @@ DEFUN (debug_ospf6_spf_database, DEBUG_STR OSPF6_STR "Debug SPF Calculation\n" - "Log number of LSAs at SPF Calculation time\n" - ) + "Log number of LSAs at SPF Calculation time\n") { unsigned char level = 0; level = OSPF6_DEBUG_SPF_DATABASE; @@ -635,8 +653,7 @@ DEFUN (no_debug_ospf6_spf_process, DEBUG_STR OSPF6_STR "Quit Debugging SPF Calculation\n" - "Quit Debugging Detailed SPF Process\n" - ) + "Quit Debugging Detailed SPF Process\n") { unsigned char level = 0; level = OSPF6_DEBUG_SPF_PROCESS; @@ -651,8 +668,7 @@ DEFUN (no_debug_ospf6_spf_time, DEBUG_STR OSPF6_STR "Quit Debugging SPF Calculation\n" - "Quit Measuring time taken by SPF Calculation\n" - ) + "Quit Measuring time taken by SPF Calculation\n") { unsigned char level = 0; level = OSPF6_DEBUG_SPF_TIME; @@ -667,8 +683,7 @@ DEFUN (no_debug_ospf6_spf_database, DEBUG_STR OSPF6_STR "Debug SPF Calculation\n" - "Quit Logging number of LSAs at SPF Calculation time\n" - ) + "Quit Logging number of LSAs at SPF Calculation time\n") { unsigned char level = 0; level = OSPF6_DEBUG_SPF_DATABASE; --- quagga-0.99.9/ospf6d/ospf6_top.c 2006-05-15 03:43:53.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_top.c 2008-04-16 11:55:47.000000000 -0700 @@ -126,6 +127,9 @@ ospf6_create () o->lsdb->hook_add = ospf6_top_lsdb_hook_add; o->lsdb->hook_remove = ospf6_top_lsdb_hook_remove; + o->minLSInterval = MIN_LS_INTERVAL; + o->minLSArrival = MIN_LS_ARRIVAL; + o->route_table = OSPF6_ROUTE_TABLE_CREATE (GLOBAL, ROUTES); o->route_table->scope = o; o->route_table->hook_add = ospf6_top_route_hook_add; @@ -240,15 +246,45 @@ void ospf6_maxage_remove (struct ospf6 *o) { if (o && ! o->maxage_remover) - o->maxage_remover = thread_add_event (master, ospf6_maxage_remover, o, 0); + { + //Delay the purging of LSAs by 60 seconds + if (o->maxage_remover == NULL) + o->maxage_remover = + thread_add_timer (master, ospf6_maxage_remover, o, 60); + } } +DEFUN (ospf6_router_minlsinterval, + ospf6_router_minlsinterval_cmd, + "router minls-interval <0-65535>", + ROUTER_STR "minimum time to originate an LSA\n" SECONDS_STR) +{ + struct ospf6 *o; + + o = (struct ospf6 *) vty->index; + o->minLSInterval = strtol (argv[0], NULL, 10); + + return CMD_SUCCESS; +} + +DEFUN (ospf6_router_minlsarrival, + ospf6_router_minlsarrival_cmd, + "router minls-arrival <0-65535>", + ROUTER_STR "minimum time to receive an LSA\n" SECONDS_STR) +{ + struct ospf6 *o; + + o = (struct ospf6 *) vty->index; + + o->minLSArrival = strtol (argv[0], NULL, 10); + + return CMD_SUCCESS; +} + + + /* start ospf6 */ -DEFUN (router_ospf6, - router_ospf6_cmd, - "router ospf6", - ROUTER_STR - OSPF6_STR) +DEFUN (router_ospf6, router_ospf6_cmd, "router ospf6", ROUTER_STR OSPF6_STR) { if (ospf6 == NULL) ospf6 = ospf6_create (); @@ -264,10 +300,7 @@ DEFUN (router_ospf6, /* stop ospf6 */ DEFUN (no_router_ospf6, - no_router_ospf6_cmd, - "no router ospf6", - NO_STR - OSPF6_ROUTER_STR) + no_router_ospf6_cmd, "no router ospf6", NO_STR OSPF6_ROUTER_STR) { if (ospf6 == NULL || CHECK_FLAG (ospf6->flag, OSPF6_DISABLED)) vty_out (vty, "OSPFv3 is not running%s", VNL); @@ -284,9 +318,7 @@ DEFUN (no_router_ospf6, /* change Router_ID commands. */ DEFUN (ospf6_router_id, ospf6_router_id_cmd, - "router-id A.B.C.D", - "Configure OSPF Router-ID\n" - V4NOTATION_STR) + "router-id A.B.C.D", "Configure OSPF Router-ID\n" V4NOTATION_STR) { int ret; u_int32_t router_id; @@ -314,8 +346,7 @@ DEFUN (ospf6_interface_area, "Enable routing on an IPv6 interface\n" IFNAME_STR "Specify the OSPF6 area ID\n" - "OSPF6 area ID in IPv4 address notation\n" - ) + "OSPF6 area ID in IPv4 address notation\n") { struct ospf6 *o; struct ospf6_area *oa; @@ -372,8 +403,7 @@ DEFUN (no_ospf6_interface_area, "Disable routing on an IPv6 interface\n" IFNAME_STR "Specify the OSPF6 area ID\n" - "OSPF6 area ID in IPv4 address notation\n" - ) + "OSPF6 area ID in IPv4 address notation\n") { struct ospf6 *o; struct ospf6_interface *oi; @@ -450,8 +480,7 @@ ospf6_show (struct vty *vty, struct ospf /* XXX */ /* LSAs */ - vty_out (vty, " Number of AS scoped LSAs is %u%s", - o->lsdb->count, VNL); + vty_out (vty, " Number of AS scoped LSAs is %u%s", o->lsdb->count, VNL); /* Areas */ vty_out (vty, " Number of areas in this router is %u%s", @@ -463,11 +492,7 @@ ospf6_show (struct vty *vty, struct ospf /* show top level structures */ DEFUN (show_ipv6_ospf6, - show_ipv6_ospf6_cmd, - "show ipv6 ospf6", - SHOW_STR - IP6_STR - OSPF6_STR) + show_ipv6_ospf6_cmd, "show ipv6 ospf6", SHOW_STR IP6_STR OSPF6_STR) { OSPF6_CMD_CHECK_RUNNING (); @@ -477,12 +502,7 @@ DEFUN (show_ipv6_ospf6, DEFUN (show_ipv6_ospf6_route, show_ipv6_ospf6_route_cmd, - "show ipv6 ospf6 route", - SHOW_STR - IP6_STR - OSPF6_STR - ROUTE_STR - ) + "show ipv6 ospf6 route", SHOW_STR IP6_STR OSPF6_STR ROUTE_STR) { ospf6_route_table_show (vty, argc, argv, ospf6->route_table); return CMD_SUCCESS; @@ -497,9 +517,7 @@ ALIAS (show_ipv6_ospf6_route, ROUTE_STR "Specify IPv6 address\n" "Specify IPv6 prefix\n" - "Detailed information\n" - "Summary of route table\n" - ); + "Detailed information\n" "Summary of route table\n"); DEFUN (show_ipv6_ospf6_route_match, show_ipv6_ospf6_route_match_cmd, @@ -509,8 +527,7 @@ DEFUN (show_ipv6_ospf6_route_match, OSPF6_STR ROUTE_STR "Specify IPv6 prefix\n" - "Display routes which match the specified route\n" - ) + "Display routes which match the specified route\n") { const char *sargv[CMD_ARGC_MAX]; int i, sargc; @@ -535,8 +552,7 @@ DEFUN (show_ipv6_ospf6_route_match_detai ROUTE_STR "Specify IPv6 prefix\n" "Display routes which match the specified route\n" - "Detailed information\n" - ) + "Detailed information\n") { const char *sargv[CMD_ARGC_MAX]; int i, sargc; @@ -561,8 +577,7 @@ ALIAS (show_ipv6_ospf6_route_match, OSPF6_STR ROUTE_STR "Specify IPv6 prefix\n" - "Display routes longer than the specified route\n" - ); + "Display routes longer than the specified route\n"); DEFUN (show_ipv6_ospf6_route_match_detail, show_ipv6_ospf6_route_longer_detail_cmd, @@ -573,8 +588,7 @@ DEFUN (show_ipv6_ospf6_route_match_detai ROUTE_STR "Specify IPv6 prefix\n" "Display routes longer than the specified route\n" - "Detailed information\n" - ); + "Detailed information\n"); ALIAS (show_ipv6_ospf6_route, show_ipv6_ospf6_route_type_cmd, @@ -585,9 +599,7 @@ ALIAS (show_ipv6_ospf6_route, ROUTE_STR "Dispaly Intra-Area routes\n" "Dispaly Inter-Area routes\n" - "Dispaly Type-1 External routes\n" - "Dispaly Type-2 External routes\n" - ); + "Dispaly Type-1 External routes\n" "Dispaly Type-2 External routes\n"); DEFUN (show_ipv6_ospf6_route_type_detail, show_ipv6_ospf6_route_type_detail_cmd, @@ -599,9 +611,7 @@ DEFUN (show_ipv6_ospf6_route_type_detail "Dispaly Intra-Area routes\n" "Dispaly Inter-Area routes\n" "Dispaly Type-1 External routes\n" - "Dispaly Type-2 External routes\n" - "Detailed information\n" - ) + "Dispaly Type-2 External routes\n" "Detailed information\n") { const char *sargv[CMD_ARGC_MAX]; int i, sargc; @@ -632,7 +642,8 @@ config_write_ospf6 (struct vty *vty) if (CHECK_FLAG (ospf6->flag, OSPF6_DISABLED)) return CMD_SUCCESS; - inet_ntop (AF_INET, &ospf6->router_id_static, router_id, sizeof (router_id)); + inet_ntop (AF_INET, &ospf6->router_id_static, router_id, + sizeof (router_id)); vty_out (vty, "router ospf6%s", VNL); if (ospf6->router_id_static != 0) vty_out (vty, " router-id %s%s", router_id, VNL); @@ -651,8 +663,7 @@ config_write_ospf6 (struct vty *vty) } /* OSPF6 node structure. */ -struct cmd_node ospf6_node = -{ +struct cmd_node ospf6_node = { OSPF6_NODE, "%s(config-ospf6)# ", 1 /* VTYSH */ @@ -691,6 +703,9 @@ ospf6_top_init () install_element (OSPF6_NODE, &ospf6_interface_area_cmd); install_element (OSPF6_NODE, &no_ospf6_interface_area_cmd); install_element (OSPF6_NODE, &no_router_ospf6_cmd); + install_element (OSPF6_NODE, &ospf6_router_minlsinterval_cmd); + install_element (OSPF6_NODE, &ospf6_router_minlsarrival_cmd); + } --- quagga-0.99.9/ospf6d/ospf6_top.h 2004-10-11 16:00:06.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_top.h 2008-04-16 11:55:47.000000000 -0700 @@ -60,6 +62,9 @@ struct ospf6 u_char flag; struct thread *maxage_remover; + int minLSInterval; + int minLSArrival; + }; #define OSPF6_DISABLED 0x01 @@ -72,6 +77,12 @@ void ospf6_top_init (); void ospf6_maxage_remove (struct ospf6 *o); -#endif /* OSPF6_TOP_H */ + + + + + + +#endif /* OSPF6_TOP_H */ --- quagga-0.99.9/ospf6d/ospf6_zebra.c 2005-10-03 07:20:32.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/ospf6d/ospf6_zebra.c 2008-04-16 11:55:47.000000000 -0700 @@ -110,7 +112,8 @@ ospf6_zebra_if_del (int command, struct return 0; if (if_is_up (ifp)) - zlog_warn ("Zebra: got delete of %s, but interface is still up", ifp->name); + zlog_warn ("Zebra: got delete of %s, but interface is still up", + ifp->name); if (IS_OSPF6_DEBUG_ZEBRA (RECV)) zlog_debug ("Zebra Interface delete: %s index %d mtu %d", @@ -148,7 +153,8 @@ ospf6_zebra_if_address_update_add (int c struct connected *c; char buf[128]; - c = zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_ADD, zclient->ibuf); + c = + zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_ADD, zclient->ibuf); if (c == NULL) return 0; @@ -171,7 +178,9 @@ ospf6_zebra_if_address_update_delete (in struct connected *c; char buf[128]; - c = zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_DELETE, zclient->ibuf); + c = + zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_DELETE, + zclient->ibuf); if (c == NULL) return 0; @@ -246,7 +257,8 @@ ospf6_zebra_read_ipv6 (int command, stru zlog_debug ("Zebra Receive route %s: %s %s nexthop %s ifindex %ld", (command == ZEBRA_IPV6_ROUTE_ADD ? "add" : "delete"), - zebra_route_string(api.type), prefixstr, nexthopstr, ifindex); + zebra_route_string (api.type), prefixstr, nexthopstr, + ifindex); } if (command == ZEBRA_IPV6_ROUTE_ADD) @@ -265,10 +277,7 @@ ospf6_zebra_read_ipv6 (int command, stru DEFUN (show_zebra, - show_zebra_cmd, - "show zebra", - SHOW_STR - "Zebra information\n") + show_zebra_cmd, "show zebra", SHOW_STR "Zebra information\n") { int i; if (zclient == NULL) @@ -280,8 +289,7 @@ DEFUN (show_zebra, vty_out (vty, "Zebra Infomation%s", VNL); vty_out (vty, " enable: %d fail: %d%s", zclient->enable, zclient->fail, VNL); - vty_out (vty, " redistribute default: %d%s", zclient->redist_default, - VNL); + vty_out (vty, " redistribute default: %d%s", zclient->redist_default, VNL); vty_out (vty, " redistribute:"); for (i = 0; i < ZEBRA_ROUTE_MAX; i++) { @@ -295,8 +303,7 @@ DEFUN (show_zebra, DEFUN (router_zebra, router_zebra_cmd, "router zebra", - "Enable a routing process\n" - "Make connection to zebra daemon\n") + "Enable a routing process\n" "Make connection to zebra daemon\n") { vty->node = ZEBRA_NODE; zclient->enable = 1; @@ -308,8 +315,7 @@ DEFUN (no_router_zebra, no_router_zebra_cmd, "no router zebra", NO_STR - "Configure routing process\n" - "Disable connection to zebra daemon\n") + "Configure routing process\n" "Disable connection to zebra daemon\n") { zclient->enable = 0; zclient_stop (zclient); @@ -335,8 +341,7 @@ config_write_ospf6_zebra (struct vty *vt } /* Zebra node structure. */ -struct cmd_node zebra_node = -{ +struct cmd_node zebra_node = { ZEBRA_NODE, "%s(config-zebra)# ", }; @@ -357,8 +362,7 @@ ospf6_zebra_route_update (int type, stru if (IS_OSPF6_DEBUG_ZEBRA (SEND)) { prefix2str (&request->prefix, buf, sizeof (buf)); - zlog_debug ("Send %s route: %s", - (type == REM ? "remove" : "add"), buf); + zlog_debug ("Send %s route: %s", (type == REM ? "remove" : "add"), buf); } if (zclient->sock < 0) @@ -419,8 +423,7 @@ ospf6_zebra_route_update (int type, stru } /* allocate memory for ifindex_list */ - ifindexes = XCALLOC (MTYPE_OSPF6_OTHER, - nhcount * sizeof (unsigned int)); + ifindexes = XCALLOC (MTYPE_OSPF6_OTHER, nhcount * sizeof (unsigned int)); if (ifindexes == NULL) { zlog_warn ("Can't send route to zebra: malloc failed"); @@ -499,9 +502,7 @@ ospf6_zebra_route_update_remove (struct DEFUN (redistribute_ospf6, redistribute_ospf6_cmd, - "redistribute ospf6", - "Redistribute control\n" - "OSPF6 route\n") + "redistribute ospf6", "Redistribute control\n" "OSPF6 route\n") { struct ospf6_route *route; @@ -527,9 +528,7 @@ DEFUN (redistribute_ospf6, DEFUN (no_redistribute_ospf6, no_redistribute_ospf6_cmd, "no redistribute ospf6", - NO_STR - "Redistribute control\n" - "OSPF6 route\n") + NO_STR "Redistribute control\n" "OSPF6 route\n") { struct ospf6_route *route; @@ -597,9 +596,7 @@ DEFUN (debug_ospf6_zebra_sendrecv, DEBUG_STR OSPF6_STR "Debug connection between zebra\n" - "Debug Sending zebra\n" - "Debug Receiving zebra\n" - ) + "Debug Sending zebra\n" "Debug Receiving zebra\n") { unsigned char level = 0; @@ -620,10 +617,7 @@ DEFUN (debug_ospf6_zebra_sendrecv, ALIAS (debug_ospf6_zebra_sendrecv, debug_ospf6_zebra_cmd, "debug ospf6 zebra", - DEBUG_STR - OSPF6_STR - "Debug connection between zebra\n" - ); + DEBUG_STR OSPF6_STR "Debug connection between zebra\n"); DEFUN (no_debug_ospf6_zebra_sendrecv, @@ -633,9 +627,7 @@ DEFUN (no_debug_ospf6_zebra_sendrecv, DEBUG_STR OSPF6_STR "Debug connection between zebra\n" - "Debug Sending zebra\n" - "Debug Receiving zebra\n" - ) + "Debug Sending zebra\n" "Debug Receiving zebra\n") { unsigned char level = 0; @@ -656,11 +648,7 @@ DEFUN (no_debug_ospf6_zebra_sendrecv, ALIAS (no_debug_ospf6_zebra_sendrecv, no_debug_ospf6_zebra_cmd, "no debug ospf6 zebra", - NO_STR - DEBUG_STR - OSPF6_STR - "Debug connection between zebra\n" - ); + NO_STR DEBUG_STR OSPF6_STR "Debug connection between zebra\n"); int config_write_ospf6_debug_zebra (struct vty *vty) @@ -688,6 +676,6 @@ install_element_ospf6_debug_zebra () install_element (CONFIG_NODE, &no_debug_ospf6_zebra_cmd); install_element (CONFIG_NODE, &debug_ospf6_zebra_sendrecv_cmd); install_element (CONFIG_NODE, &no_debug_ospf6_zebra_sendrecv_cmd); -} +} --- quagga-0.99.9/zebra/ioctl.c 2007-05-09 13:59:34.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/zebra/ioctl.c 2008-04-16 11:55:47.000000000 -0700 @@ -549,13 +549,13 @@ if_prefix_delete_ipv6 (struct interface int if_prefix_add_ipv6 (struct interface *ifp, struct connected *ifc) { - return 0; + return -1; } int if_prefix_delete_ipv6 (struct interface *ifp, struct connected *ifc) { - return 0; + return -1; } #endif /* HAVE_STRUCT_IN6_ALIASREQ */ --- quagga-0.99.9/zebra/kernel_socket.c 2007-08-22 09:22:57.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/zebra/kernel_socket.c 2008-04-16 11:55:47.000000000 -0700 @@ -305,6 +305,7 @@ int ifm_read (struct if_msghdr *ifm) { struct interface *ifp = NULL; + struct sockaddr_dl *sdl; char ifname[IFNAMSIZ]; short ifnlen = 0; caddr_t *cp; @@ -342,6 +343,7 @@ ifm_read (struct if_msghdr *ifm) RTA_ADDR_GET (NULL, RTA_GATEWAY, ifm->ifm_addrs, cp); RTA_ATTR_GET (NULL, RTA_NETMASK, ifm->ifm_addrs, cp); RTA_ADDR_GET (NULL, RTA_GENMASK, ifm->ifm_addrs, cp); + sdl = (struct sockaddr_dl *)cp; RTA_NAME_GET (ifname, RTA_IFP, ifm->ifm_addrs, cp, ifnlen); RTA_ADDR_GET (NULL, RTA_IFA, ifm->ifm_addrs, cp); RTA_ADDR_GET (NULL, RTA_AUTHOR, ifm->ifm_addrs, cp); @@ -435,6 +437,19 @@ ifm_read (struct if_msghdr *ifm) #endif /* __bsdi__ */ if_get_metric (ifp); + /* + * ifp->sdl should be set because it might be used by + * rtm_write() when gate is NULL. sdl should be valid if we get + * here since RTA_NAME_GET() already did a bunch of checks. + */ + + /* + * XXX sockaddr_dl contents can be larger than the structure + * definition, so the user of the stored structure must be + * careful not to read off the end. + */ + memcpy (&ifp->sdl, sdl, sizeof (struct sockaddr_dl)); + if_add_update (ifp); } else @@ -889,6 +904,11 @@ rtm_read (struct rt_msghdr *rtm) struct prefix_ipv6 p; unsigned int ifindex = 0; + /* Catch self originated messages */ + if (rtm->rtm_type != RTM_GET && + (rtm->rtm_pid == pid || rtm->rtm_pid == old_pid)) + return; + p.family = AF_INET6; p.prefix = dest.sin6.sin6_addr; if (flags & RTF_HOST) --- quagga-0.99.9/zebra/rt_ioctl.c 2007-05-09 13:59:35.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/zebra/rt_ioctl.c 2008-04-16 11:55:47.000000000 -0700 @@ -31,6 +31,9 @@ #include "zebra/debug.h" #include "zebra/rt.h" +#include "privs.h" +extern struct zebra_privs_t zserv_privs; + /* Initialize of kernel interface. There is no kernel communication support under ioctl(). So this is dummy stub function. */ void @@ -172,6 +175,7 @@ kernel_ioctl_ipv4 (u_long cmd, struct pr struct nexthop *nexthop; int nexthop_num = 0; struct interface *ifp; + int save_errno; memset (&rtentry, 0, sizeof (struct rtentry)); @@ -307,11 +311,23 @@ kernel_ioctl_ipv4 (u_long cmd, struct pr return -1; } + /* Bind the socket to the netlink structure for anything. */ + if (zserv_privs.change (ZPRIVS_RAISE)) + { + zlog (NULL, LOG_ERR, "Can't raise privileges"); + return -1; + } + /* Send message by ioctl(). */ ret = ioctl (sock, cmd, &rtentry); + + save_errno = errno; + if (zserv_privs.change (ZPRIVS_LOWER)) + zlog (NULL, LOG_ERR, "Can't lower privileges"); + if (ret < 0) { - switch (errno) + switch (save_errno) { case EEXIST: close (sock); @@ -328,7 +344,7 @@ kernel_ioctl_ipv4 (u_long cmd, struct pr } close (sock); - zlog_warn ("write : %s (%d)", safe_strerror (errno), errno); + zlog_warn ("write : %s (%d)", safe_strerror (save_errno), save_errno); return ret; } close (sock); --- quagga-0.99.9/zebra/rt_netlink.c 2007-08-13 09:35:14.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/zebra/rt_netlink.c 2008-04-16 11:55:47.000000000 -0700 @@ -1466,15 +1466,24 @@ netlink_route_multipath (int cmd, struct { for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next) { - +// Modified by MJH 2/19/2007 to force delete if state is _ACTIVE || _FIB */ if ((cmd == RTM_NEWROUTE && CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE)) || (cmd == RTM_DELROUTE - && CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB))) + && (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) || + CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE)))) { if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE)) { + /* direct (single hop) routes should have link scope */ + if (nexthop->rtype == NEXTHOP_TYPE_IFINDEX + || nexthop->rtype == NEXTHOP_TYPE_IFNAME + || nexthop->rtype == NEXTHOP_TYPE_IPV4_IFINDEX + || nexthop->rtype == NEXTHOP_TYPE_IPV6_IFINDEX + || nexthop->rtype == NEXTHOP_TYPE_IPV6_IFNAME) + req.r.rtm_scope = RT_SCOPE_LINK; + if (IS_ZEBRA_DEBUG_KERNEL) { zlog_debug @@ -1541,6 +1550,14 @@ netlink_route_multipath (int cmd, struct } else { + /* direct (single hop) routes should have link scope */ + if (nexthop->type == NEXTHOP_TYPE_IFINDEX + || nexthop->type == NEXTHOP_TYPE_IFNAME + || nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX + || nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX + || nexthop->type == NEXTHOP_TYPE_IPV6_IFNAME) + req.r.rtm_scope = RT_SCOPE_LINK; + if (IS_ZEBRA_DEBUG_KERNEL) { zlog_debug --- quagga-0.99.9/zebra/rt_socket.c 2007-08-13 09:35:14.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/zebra/rt_socket.c 2008-04-16 11:55:47.000000000 -0700 @@ -98,8 +98,8 @@ kernel_rtm_ipv4 (int cmd, struct prefix /* Make gateway. */ for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next) { - gate = 0; char gate_buf[INET_ADDRSTRLEN] = "NULL"; + gate = 0; /* * XXX We need to refrain from kernel operations in some cases, @@ -207,6 +207,9 @@ kernel_rtm_ipv4 (int cmd, struct prefix case ZEBRA_ERR_RTNOEXIST: case ZEBRA_ERR_RTUNREACH: default: + if (!IS_ZEBRA_DEBUG_RIB) + inet_ntop (AF_INET, &p->u.prefix, prefix_buf, INET_ADDRSTRLEN); + zlog_err ("%s: %s/%d: rtm_write() unexpectedly returned %d for command %s", __func__, prefix_buf, p->prefixlen, error, LOOKUP (rtm_type_str, cmd)); break; --- quagga-0.99.9/zebra/zebra_rib.c 2007-08-22 09:22:57.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/zebra/zebra_rib.c 2008-04-16 11:55:47.000000000 -0700 @@ -369,7 +369,6 @@ nexthop_active_ipv4 (struct rib *rib, st while (rn) { route_unlock_node (rn); - /* If lookup self prefix return immidiately. */ if (rn == top) return 0; @@ -953,7 +952,7 @@ rib_uninstall_kernel (struct route_node #ifdef HAVE_IPV6 case AF_INET6: if (IS_ZEBRA_DEBUG_RIB) - zlog_debug ("%s: calling kernel_delete_ipv4 (%p, %p)", __func__, rn, rib); + zlog_debug ("%s: calling kernel_delete_ipv6 (%p, %p)", __func__, rn, rib); ret = kernel_delete_ipv6 (&rn->p, rib); break; #endif /* HAVE_IPV6 */ @@ -992,12 +991,12 @@ rib_process (struct work_queue *wq, void struct route_node *rn = data; int installed = 0; struct nexthop *nexthop = NULL; - char buf[INET_ADDRSTRLEN]; + char buf[INET6_ADDRSTRLEN]; assert (rn); if (IS_ZEBRA_DEBUG_RIB || IS_ZEBRA_DEBUG_RIB_Q) - inet_ntop (AF_INET, &rn->p.u.prefix, buf, INET_ADDRSTRLEN); + inet_ntop(rn->p.family, &rn->p.u.prefix, buf, sizeof(buf)); for (rib = rn->info; rib; rib = next) { @@ -1033,7 +1032,12 @@ rib_process (struct work_queue *wq, void /* Skip unreachable nexthop. */ if (! nexthop_active_update (rn, rib, 0)) + { + if (IS_ZEBRA_DEBUG_RIB) + zlog_debug("%s: skipping %s/%d because nexthop is not active", + __func__, buf, rn->p.prefixlen); continue; + } /* Infinit distance. */ if (rib->distance == DISTANCE_INFINITY) @@ -1186,11 +1190,11 @@ end: static void rib_queue_add (struct zebra_t *zebra, struct route_node *rn) { - char buf[INET_ADDRSTRLEN]; + char buf[INET6_ADDRSTRLEN]; assert (zebra && rn); if (IS_ZEBRA_DEBUG_RIB_Q) - inet_ntop (AF_INET, &rn->p.u.prefix, buf, INET_ADDRSTRLEN); + inet_ntop(rn->p.family, &rn->p.u.prefix, buf, sizeof(buf)); /* Pointless to queue a route_node with no RIB entries to add or remove */ if (!rn->info) @@ -1300,7 +1304,7 @@ static void rib_link (struct route_node *rn, struct rib *rib) { struct rib *head; - char buf[INET_ADDRSTRLEN]; + char buf[INET6_ADDRSTRLEN]; assert (rib && rn); @@ -1308,7 +1312,7 @@ rib_link (struct route_node *rn, struct if (IS_ZEBRA_DEBUG_RIB) { - inet_ntop (AF_INET, &rn->p.u.prefix, buf, INET_ADDRSTRLEN); + inet_ntop(rn->p.family, &rn->p.u.prefix, buf, sizeof(buf)); zlog_debug ("%s: %s/%d: rn %p, rib %p", __func__, buf, rn->p.prefixlen, rn, rib); } @@ -1338,8 +1342,8 @@ rib_addnode (struct route_node *rn, stru { if (IS_ZEBRA_DEBUG_RIB) { - char buf[INET_ADDRSTRLEN]; - inet_ntop (AF_INET, &rn->p.u.prefix, buf, INET_ADDRSTRLEN); + char buf[INET6_ADDRSTRLEN]; + inet_ntop(rn->p.family, &rn->p.u.prefix, buf, sizeof(buf)); zlog_debug ("%s: %s/%d: rn %p, un-removed rib %p", __func__, buf, rn->p.prefixlen, rn, rib); } @@ -1353,13 +1357,13 @@ static void rib_unlink (struct route_node *rn, struct rib *rib) { struct nexthop *nexthop, *next; - char buf[INET_ADDRSTRLEN]; + char buf[INET6_ADDRSTRLEN]; assert (rn && rib); if (IS_ZEBRA_DEBUG_RIB) { - inet_ntop (AF_INET, &rn->p.u.prefix, buf, INET_ADDRSTRLEN); + inet_ntop(rn->p.family, &rn->p.u.prefix, buf, sizeof(buf)); zlog_debug ("%s: %s/%d: rn %p, rib %p", __func__, buf, rn->p.prefixlen, rn, rib); } @@ -1398,8 +1402,8 @@ rib_delnode (struct route_node *rn, stru { if (IS_ZEBRA_DEBUG_RIB) { - char buf[INET_ADDRSTRLEN]; - inet_ntop (AF_INET, &rn->p.u.prefix, buf, INET_ADDRSTRLEN); + char buf[INET6_ADDRSTRLEN]; + inet_ntop(rn->p.family, &rn->p.u.prefix, buf, sizeof(buf)); zlog_debug ("%s: %s/%d: rn %p, rib %p, removing", __func__, buf, rn->p.prefixlen, rn, rib); } --- quagga-0.99.9/zebra/zserv.c 2007-05-09 13:59:35.000000000 -0700 +++ quagga-0.99.9.ospfv3-extensions.tmp/zebra/zserv.c 2008-04-16 11:55:47.000000000 -0700 @@ -758,6 +758,12 @@ zread_ipv4_add (struct zserv *client, u_ memset (&p, 0, sizeof (struct prefix_ipv4)); p.family = AF_INET; p.prefixlen = stream_getc (s); + if (p.prefixlen > IPV4_MAX_PREFIXLEN) + { + zlog_warn("%s: invalid ipv4 prefixlen: %d", __func__, p.prefixlen); + XFREE(MTYPE_RIB, rib); + return -1; + } stream_get (&p.prefix, s, PSIZE (p.prefixlen)); /* Nexthop parse. */ @@ -834,6 +840,11 @@ zread_ipv4_delete (struct zserv *client, memset (&p, 0, sizeof (struct prefix_ipv4)); p.family = AF_INET; p.prefixlen = stream_getc (s); + if (p.prefixlen > IPV4_MAX_PREFIXLEN) + { + zlog_warn("%s: invalid ipv4 prefixlen: %d", __func__, p.prefixlen); + return -1; + } stream_get (&p.prefix, s, PSIZE (p.prefixlen)); /* Nexthop, ifindex, distance, metric. */ @@ -929,6 +940,11 @@ zread_ipv6_add (struct zserv *client, u_ memset (&p, 0, sizeof (struct prefix_ipv6)); p.family = AF_INET6; p.prefixlen = stream_getc (s); + if (p.prefixlen > IPV6_MAX_PREFIXLEN) + { + zlog_warn("%s: invalid ipv6 prefixlen: %d", __func__, p.prefixlen); + return -1; + } stream_get (&p.prefix, s, PSIZE (p.prefixlen)); /* Nexthop, ifindex, distance, metric. */ @@ -996,6 +1012,11 @@ zread_ipv6_delete (struct zserv *client, memset (&p, 0, sizeof (struct prefix_ipv6)); p.family = AF_INET6; p.prefixlen = stream_getc (s); + if (p.prefixlen > IPV6_MAX_PREFIXLEN) + { + zlog_warn("%s: invalid ipv6 prefixlen: %d", __func__, p.prefixlen); + return -1; + } stream_get (&p.prefix, s, PSIZE (p.prefixlen)); /* Nexthop, ifindex, distance, metric. */