diff options
Diffstat (limited to 'ospf6d')
-rw-r--r-- | ospf6d/Makefile.am | 1 | ||||
-rw-r--r-- | ospf6d/ospf6_asbr.c | 75 | ||||
-rw-r--r-- | ospf6d/ospf6_interface.c | 17 | ||||
-rw-r--r-- | ospf6d/ospf6_lsa.c | 11 | ||||
-rw-r--r-- | ospf6d/ospf6_lsdb.c | 12 | ||||
-rw-r--r-- | ospf6d/ospf6_main.c | 24 | ||||
-rw-r--r-- | ospf6d/ospf6_route.c | 5 | ||||
-rw-r--r-- | ospf6d/ospf6_top.c | 2 |
8 files changed, 53 insertions, 94 deletions
diff --git a/ospf6d/Makefile.am b/ospf6d/Makefile.am index 01bc6fe0..eeed1652 100644 --- a/ospf6d/Makefile.am +++ b/ospf6d/Makefile.am @@ -1,7 +1,6 @@ ## Process this file with automake to produce Makefile.in. INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib @SNMP_INCLUDES@ -DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" INSTALL_SDATA=@INSTALL@ -m 600 AM_CFLAGS = $(PICFLAGS) diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index 685b147c..d6c1517e 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -616,27 +616,16 @@ ospf6_asbr_redistribute_remove (int type, int ifindex, struct prefix *prefix) DEFUN (ospf6_redistribute, ospf6_redistribute_cmd, - "redistribute (static|kernel|connected|ripng|bgp)", + "redistribute " QUAGGA_REDIST_STR_OSPF6D, "Redistribute\n" - "Static route\n" - "Kernel route\n" - "Connected route\n" - "RIPng route\n" - "BGP route\n" + QUAGGA_REDIST_HELP_STR_OSPF6D ) { - int type = 0; - - if (strncmp (argv[0], "sta", 3) == 0) - type = ZEBRA_ROUTE_STATIC; - else if (strncmp (argv[0], "ker", 3) == 0) - type = ZEBRA_ROUTE_KERNEL; - else if (strncmp (argv[0], "con", 3) == 0) - type = ZEBRA_ROUTE_CONNECT; - else if (strncmp (argv[0], "rip", 3) == 0) - type = ZEBRA_ROUTE_RIPNG; - else if (strncmp (argv[0], "bgp", 3) == 0) - type = ZEBRA_ROUTE_BGP; + int type; + + type = proto_redistnum(AFI_IP6, argv[0]); + if (type < 0 || type == ZEBRA_ROUTE_OSPF6) + return CMD_WARNING; ospf6_asbr_redistribute_unset (type); ospf6_asbr_routemap_unset (type); @@ -646,29 +635,18 @@ DEFUN (ospf6_redistribute, DEFUN (ospf6_redistribute_routemap, ospf6_redistribute_routemap_cmd, - "redistribute (static|kernel|connected|ripng|bgp) route-map WORD", + "redistribute " QUAGGA_REDIST_STR_OSPF6D " route-map WORD", "Redistribute\n" - "Static routes\n" - "Kernel route\n" - "Connected route\n" - "RIPng route\n" - "BGP route\n" + QUAGGA_REDIST_HELP_STR_OSPF6D "Route map reference\n" "Route map name\n" ) { - int type = 0; - - if (strncmp (argv[0], "sta", 3) == 0) - type = ZEBRA_ROUTE_STATIC; - else if (strncmp (argv[0], "ker", 3) == 0) - type = ZEBRA_ROUTE_KERNEL; - else if (strncmp (argv[0], "con", 3) == 0) - type = ZEBRA_ROUTE_CONNECT; - else if (strncmp (argv[0], "rip", 3) == 0) - type = ZEBRA_ROUTE_RIPNG; - else if (strncmp (argv[0], "bgp", 3) == 0) - type = ZEBRA_ROUTE_BGP; + int type; + + type = proto_redistnum(AFI_IP6, argv[0]); + if (type < 0 || type == ZEBRA_ROUTE_OSPF6) + return CMD_WARNING; ospf6_asbr_redistribute_unset (type); ospf6_asbr_routemap_set (type, argv[1]); @@ -678,28 +656,17 @@ DEFUN (ospf6_redistribute_routemap, DEFUN (no_ospf6_redistribute, no_ospf6_redistribute_cmd, - "no redistribute (static|kernel|connected|ripng|bgp)", + "no redistribute " QUAGGA_REDIST_STR_OSPF6D, NO_STR "Redistribute\n" - "Static route\n" - "Kernel route\n" - "Connected route\n" - "RIPng route\n" - "BGP route\n" + QUAGGA_REDIST_HELP_STR_OSPF6D ) { - int type = 0; - - if (strncmp (argv[0], "sta", 3) == 0) - type = ZEBRA_ROUTE_STATIC; - else if (strncmp (argv[0], "ker", 3) == 0) - type = ZEBRA_ROUTE_KERNEL; - else if (strncmp (argv[0], "con", 3) == 0) - type = ZEBRA_ROUTE_CONNECT; - else if (strncmp (argv[0], "rip", 3) == 0) - type = ZEBRA_ROUTE_RIPNG; - else if (strncmp (argv[0], "bgp", 3) == 0) - type = ZEBRA_ROUTE_BGP; + int type; + + type = proto_redistnum(AFI_IP6, argv[0]); + if (type < 0 || type == ZEBRA_ROUTE_OSPF6) + return CMD_WARNING; ospf6_asbr_redistribute_unset (type); ospf6_asbr_routemap_unset (type); diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 2cd5303f..777bc7c9 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -690,23 +690,6 @@ neighbor_change (struct thread *thread) return 0; } -static int -loopind (struct thread *thread) -{ - struct ospf6_interface *oi; - - oi = (struct ospf6_interface *) THREAD_ARG (thread); - assert (oi && oi->interface); - - if (IS_OSPF6_DEBUG_INTERFACE) - zlog_debug ("Interface Event %s: [LoopInd]", - oi->interface->name); - - /* XXX not yet */ - - return 0; -} - int interface_down (struct thread *thread) { diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index 07d9f91e..c1db3741 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -256,7 +256,7 @@ ospf6_lsa_premature_aging (struct ospf6_lsa *lsa) int ospf6_lsa_compare (struct ospf6_lsa *a, struct ospf6_lsa *b) { - signed long seqnuma, seqnumb; + int seqnuma, seqnumb; u_int16_t cksuma, cksumb; u_int16_t agea, ageb; @@ -264,16 +264,13 @@ ospf6_lsa_compare (struct ospf6_lsa *a, struct ospf6_lsa *b) assert (b && b->header); assert (OSPF6_LSA_IS_SAME (a, b)); - seqnuma = ((signed long) ntohl (a->header->seqnum)) - - (signed long) INITIAL_SEQUENCE_NUMBER; - seqnumb = ((signed long) ntohl (b->header->seqnum)) - - (signed long) INITIAL_SEQUENCE_NUMBER; + seqnuma = (int) ntohl (a->header->seqnum); + seqnumb = (int) ntohl (b->header->seqnum); /* compare by sequence number */ - /* XXX, LS sequence number wrapping */ if (seqnuma > seqnumb) return -1; - else if (seqnuma < seqnumb) + if (seqnuma < seqnumb) return 1; /* Checksum */ diff --git a/ospf6d/ospf6_lsdb.c b/ospf6d/ospf6_lsdb.c index b839d16e..280bdf95 100644 --- a/ospf6d/ospf6_lsdb.c +++ b/ospf6d/ospf6_lsdb.c @@ -258,9 +258,6 @@ ospf6_lsdb_lookup (u_int16_t type, u_int32_t id, u_int32_t adv_router, return (struct ospf6_lsa *) node->info; } -/* Macro version of check_bit (). */ -#define CHECK_BIT(X,P) ((((u_char *)(X))[(P) / 8]) >> (7 - ((P) % 8)) & 1) - struct ospf6_lsa * ospf6_lsdb_lookup_next (u_int16_t type, u_int32_t id, u_int32_t adv_router, struct ospf6_lsdb *lsdb) @@ -291,7 +288,7 @@ ospf6_lsdb_lookup_next (u_int16_t type, u_int32_t id, u_int32_t adv_router, prefix_match (&node->p, p)) { matched = node; - node = node->link[CHECK_BIT(&p->u.prefix, node->p.prefixlen)]; + node = node->link[prefix_bit(&p->u.prefix, node->p.prefixlen)]; } if (matched) @@ -384,7 +381,7 @@ ospf6_lsdb_type_router_head (u_int16_t type, u_int32_t adv_router, /* Walk down tree. */ while (node && node->p.prefixlen <= key.prefixlen && prefix_match (&node->p, (struct prefix *) &key)) - node = node->link[CHECK_BIT(&key.prefix, node->p.prefixlen)]; + node = node->link[prefix6_bit(&key.prefix, node->p.prefixlen)]; if (node) route_lock_node (node); @@ -438,7 +435,7 @@ ospf6_lsdb_type_head (u_int16_t type, struct ospf6_lsdb *lsdb) node = lsdb->table->top; while (node && node->p.prefixlen <= key.prefixlen && prefix_match (&node->p, (struct prefix *) &key)) - node = node->link[CHECK_BIT(&key.prefix, node->p.prefixlen)]; + node = node->link[prefix6_bit(&key.prefix, node->p.prefixlen)]; if (node) route_lock_node (node); @@ -553,7 +550,10 @@ ospf6_new_ls_id (u_int16_t type, u_int32_t adv_router, if (ntohl (lsa->header->id) < id) continue; if (ntohl (lsa->header->id) > id) + { + ospf6_lsa_unlock (lsa); break; + } id++; } diff --git a/ospf6d/ospf6_main.c b/ospf6d/ospf6_main.c index a7a96a1f..c33fe9f2 100644 --- a/ospf6d/ospf6_main.c +++ b/ospf6d/ospf6_main.c @@ -34,11 +34,14 @@ #include "plist.h" #include "privs.h" #include "sigevent.h" +#include "paths.h" #include "ospf6d.h" /* Default configuration file name for ospf6d. */ -#define OSPF6_DEFAULT_CONFIG "ospf6d.conf" +#define OSPF6_CONFIG_NAME "ospf6d.conf" +#define OSPF6_PID_NAME "ospf6d.pid" +#define OSPF6_VTY_NAME "ospf6d.vty" /* Default port values. */ #define OSPF6_VTY_PORT 2606 @@ -70,6 +73,7 @@ struct zebra_privs_t ospf6d_privs = struct option longopts[] = { { "daemon", no_argument, NULL, 'd'}, + { "namespace", required_argument, NULL, 'N'}, { "config_file", required_argument, NULL, 'f'}, { "pid_file", required_argument, NULL, 'i'}, { "vty_addr", required_argument, NULL, 'A'}, @@ -83,7 +87,7 @@ struct option longopts[] = }; /* Configuration file and directory. */ -char config_default[] = SYSCONFDIR OSPF6_DEFAULT_CONFIG; +char config_default[MAXPATHLEN]; /* ospf6d program name. */ char *progname; @@ -94,8 +98,11 @@ int daemon_mode = 0; /* Master of threads. */ struct thread_master *master; +/* pid_file default value */ +static char pid_file_default[MAXPATHLEN]; + /* Process ID saved for use by init system */ -const char *pid_file = PATH_OSPF6D_PID; +const char *pid_file = pid_file_default; /* Help information display. */ static void @@ -108,6 +115,7 @@ usage (char *progname, int status) printf ("Usage : %s [OPTION...]\n\n\ Daemon which manages OSPF version 3.\n\n\ -d, --daemon Runs in daemon mode\n\ +-N, --namespace Insert argument into all paths\n\ -f, --config_file Set configuration file name\n\ -i, --pid_file Set process identifier file name\n\ -A, --vty_addr Set vty's bind address\n\ @@ -197,7 +205,7 @@ main (int argc, char *argv[], char *envp[]) /* Command line argument treatment. */ while (1) { - opt = getopt_long (argc, argv, "df:i:hp:A:P:u:g:vC", longopts, 0); + opt = getopt_long (argc, argv, "dN:f:i:hp:A:P:u:g:vC", longopts, 0); if (opt == EOF) break; @@ -209,6 +217,9 @@ main (int argc, char *argv[], char *envp[]) case 'd': daemon_mode = 1; break; + case 'N': + path_set_namespace (optarg); + break; case 'f': config_file = optarg; break; @@ -252,6 +263,9 @@ main (int argc, char *argv[], char *envp[]) } } + strcpy (config_default, path_config (OSPF6_CONFIG_NAME)); + strcpy (pid_file_default, path_state (OSPF6_PID_NAME)); + /* thread master */ master = thread_master_create (); @@ -294,7 +308,7 @@ main (int argc, char *argv[], char *envp[]) /* Make ospf6 vty socket. */ if (!vty_port) vty_port = OSPF6_VTY_PORT; - vty_serv_sock (vty_addr, vty_port, OSPF6_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, path_state (OSPF6_VTY_NAME)); /* Print start message */ zlog_notice ("OSPF6d (Quagga-%s ospf6d-%s) starts: vty@%d", diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c index 9832f570..1e1f4fb5 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -706,9 +706,6 @@ ospf6_route_best_next (struct ospf6_route *route) return next; } -/* Macro version of check_bit (). */ -#define CHECK_BIT(X,P) ((((u_char *)(X))[(P) / 8]) >> (7 - ((P) % 8)) & 1) - struct ospf6_route * ospf6_route_match_head (struct prefix *prefix, struct ospf6_route_table *table) @@ -720,7 +717,7 @@ ospf6_route_match_head (struct prefix *prefix, node = table->table->top; while (node && node->p.prefixlen < prefix->prefixlen && prefix_match (&node->p, prefix)) - node = node->link[CHECK_BIT(&prefix->u.prefix, node->p.prefixlen)]; + node = node->link[prefix_bit(&prefix->u.prefix, node->p.prefixlen)]; if (node) route_lock_node (node); diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index c4cc9fac..82370268 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -143,6 +143,7 @@ ospf6_create (void) return o; } +#if 0 static void ospf6_delete (struct ospf6 *o) { @@ -163,6 +164,7 @@ ospf6_delete (struct ospf6 *o) XFREE (MTYPE_OSPF6_TOP, o); } +#endif static void ospf6_enable (struct ospf6 *o) |