From 6d0732c8abad7ace509d033a41814ea03a3a1b16 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 28 Sep 2011 14:23:35 +0400 Subject: IPv6 transport class suppport IPv6 supports the same concept of differentiated service for routing protocols as IPv4, but like too many things, the standards committee decided that having two names for the same thing wasn't good enough and introduced a third more generic term transport class. The socket option to set transport class works the same as IPv4, but the arguments are different. * lib/sockopt.[ch] * setsockopt_ipv6_tclass(): new function * bgpd/bgp_network.c * bgp_connect(): set socket option * bgp_listener(): set socket option * ospf6d/ospf6_network.c * ospf6_set_transport_class(): new function * ospf6_serv_sock(): set socket option * ripngd/ripngd.c * ripng_make_socket(): set socket option --- ripngd/ripngd.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ripngd') diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index 6e32d83c..d416255c 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -117,6 +117,11 @@ ripng_make_socket (void) ret = setsockopt_ipv6_pktinfo (sock, 1); if (ret < 0) return ret; +#ifdef IPTOS_PREC_INTERNETCONTROL + ret = setsockopt_ipv6_tclass (sock, IPTOS_PREC_INTERNETCONTROL); + if (ret < 0) + return ret; +#endif ret = setsockopt_ipv6_multicast_hops (sock, 255); if (ret < 0) return ret; -- cgit v1.2.1 From 6989880ad7699cb6bf0cfc0fbb95da51430652cf Mon Sep 17 00:00:00 2001 From: Ulrich Weber Date: Thu, 17 Nov 2011 21:35:08 +0400 Subject: ripngd: limit max of "timers basic" to 65535 as documented and use VTY_GET_INTEGER_RANGE instead of calling strtoul --- ripngd/ripngd.c | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) (limited to 'ripngd') diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index d416255c..8e97c2f8 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -2485,28 +2485,10 @@ DEFUN (ripng_timers, unsigned long update; unsigned long timeout; unsigned long garbage; - char *endptr = NULL; - update = strtoul (argv[0], &endptr, 10); - if (update == ULONG_MAX || *endptr != '\0') - { - vty_out (vty, "update timer value error%s", VTY_NEWLINE); - return CMD_WARNING; - } - - timeout = strtoul (argv[1], &endptr, 10); - if (timeout == ULONG_MAX || *endptr != '\0') - { - vty_out (vty, "timeout timer value error%s", VTY_NEWLINE); - return CMD_WARNING; - } - - garbage = strtoul (argv[2], &endptr, 10); - if (garbage == ULONG_MAX || *endptr != '\0') - { - vty_out (vty, "garbage timer value error%s", VTY_NEWLINE); - return CMD_WARNING; - } + VTY_GET_INTEGER_RANGE("update timer", update, argv[0], 0, 65535); + VTY_GET_INTEGER_RANGE("timeout timer", timeout, argv[1], 0, 65535); + VTY_GET_INTEGER_RANGE("garbage timer", garbage, argv[2], 0, 65535); /* Set each timer value. */ ripng->update_time = update; -- cgit v1.2.1 From b51146856e660bcec723f535c17dc1c38b2f6efc Mon Sep 17 00:00:00 2001 From: Vyacheslav Trushkin Date: Fri, 25 Nov 2011 18:51:48 +0400 Subject: quagga: option "-z" ("--socket ") added All daemons modified to support custom path to zserv socket. lib: generalize a zclient connection zclient_socket_connect added. zclient_socket and zclient_socket_un were hidden under static expression. "zclient_serv_path_set" modified. --- ripngd/ripng_main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'ripngd') diff --git a/ripngd/ripng_main.c b/ripngd/ripng_main.c index 85209a15..f4a62440 100644 --- a/ripngd/ripng_main.c +++ b/ripngd/ripng_main.c @@ -47,6 +47,7 @@ struct option longopts[] = { "daemon", no_argument, NULL, 'd'}, { "config_file", required_argument, NULL, 'f'}, { "pid_file", required_argument, NULL, 'i'}, + { "socket", required_argument, NULL, 'z'}, { "dryrun", no_argument, NULL, 'C'}, { "help", no_argument, NULL, 'h'}, { "vty_addr", required_argument, NULL, 'A'}, @@ -112,6 +113,7 @@ Daemon which manages RIPng.\n\n\ -d, --daemon Runs in daemon mode\n\ -f, --config_file Set configuration file name\n\ -i, --pid_file Set process identifier file name\n\ +-z, --socket Set path of zebra socket\n\ -A, --vty_addr Set vty's bind address\n\ -P, --vty_port Set vty's port number\n\ -r, --retain When program terminates, retain added route by ripngd.\n\ @@ -205,7 +207,7 @@ main (int argc, char **argv) { int opt; - opt = getopt_long (argc, argv, "df:i:hA:P:u:g:vC", longopts, 0); + opt = getopt_long (argc, argv, "df:i:z:hA:P:u:g:vC", longopts, 0); if (opt == EOF) break; @@ -225,7 +227,10 @@ main (int argc, char **argv) break; case 'i': pid_file = optarg; - break; + break; + case 'z': + zclient_serv_path_set (optarg); + break; case 'P': /* Deal with atoi() returning 0 on failure, and ripngd not listening on ripngd port... */ -- cgit v1.2.1 From 05e54ee3df973194f2a00e3ea0b1da7bebc71fd6 Mon Sep 17 00:00:00 2001 From: Denis Ovsienko Date: Sat, 3 Dec 2011 17:45:17 +0400 Subject: build: delete .cvsignore files --- ripngd/.cvsignore | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 ripngd/.cvsignore (limited to 'ripngd') diff --git a/ripngd/.cvsignore b/ripngd/.cvsignore deleted file mode 100644 index 48f45cef..00000000 --- a/ripngd/.cvsignore +++ /dev/null @@ -1,14 +0,0 @@ -Makefile -Makefile.in -*.o -ripngd -ripngd.conf -tags -TAGS -.deps -.nfs* -*.lo -*.la -*.libs -.arch-inventory -.arch-ids -- cgit v1.2.1 From b4e45f67057be22133b6bec88cdf285d5c8214db Mon Sep 17 00:00:00 2001 From: Denis Ovsienko Date: Mon, 5 Dec 2011 16:35:14 +0400 Subject: fix zebra protocol after MP-BGP changes The previous commits modified both zebra and bgpd for additional SAFI field, but not any other routing daemon, which led to zebra daemon crashing with failed assertion. --- ripngd/ripng_zebra.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ripngd') diff --git a/ripngd/ripng_zebra.c b/ripngd/ripng_zebra.c index 4c444550..c931a291 100644 --- a/ripngd/ripng_zebra.c +++ b/ripngd/ripng_zebra.c @@ -53,6 +53,7 @@ ripng_zebra_ipv6_add (struct prefix_ipv6 *p, struct in6_addr *nexthop, api.type = ZEBRA_ROUTE_RIPNG; api.flags = 0; api.message = 0; + api.safi = SAFI_UNICAST; SET_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP); api.nexthop_num = 1; api.nexthop = &nexthop; @@ -77,6 +78,7 @@ ripng_zebra_ipv6_delete (struct prefix_ipv6 *p, struct in6_addr *nexthop, api.type = ZEBRA_ROUTE_RIPNG; api.flags = 0; api.message = 0; + api.safi = SAFI_UNICAST; SET_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP); api.nexthop_num = 1; api.nexthop = &nexthop; -- cgit v1.2.1 From 93079db65cbb678d7fb67f7dd871e24c12b86f09 Mon Sep 17 00:00:00 2001 From: Matthieu Boutier Date: Thu, 9 Feb 2012 20:58:07 +0100 Subject: ripngd: Replace redistribution strings with route_types.h defines. --- ripngd/ripng_zebra.c | 198 +++++++++++++++++++-------------------------------- 1 file changed, 74 insertions(+), 124 deletions(-) (limited to 'ripngd') diff --git a/ripngd/ripng_zebra.c b/ripngd/ripng_zebra.c index c931a291..8e766062 100644 --- a/ripngd/ripng_zebra.c +++ b/ripngd/ripng_zebra.c @@ -217,7 +217,8 @@ static struct { {ZEBRA_ROUTE_CONNECT, 1, "connected"}, {ZEBRA_ROUTE_STATIC, 1, "static"}, {ZEBRA_ROUTE_OSPF6, 1, "ospf6"}, - {ZEBRA_ROUTE_BGP, 1, "bgp"}, + {ZEBRA_ROUTE_BGP, 2, "bgp"}, + {ZEBRA_ROUTE_BABEL, 2, "babel"}, {0, 0, NULL} }; @@ -289,198 +290,147 @@ DEFUN (no_ripng_redistribute_ripng, DEFUN (ripng_redistribute_type, ripng_redistribute_type_cmd, - "redistribute (kernel|connected|static|ospf6|bgp)", - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Open Shortest Path First (OSPFv3)\n" - "Border Gateway Protocol (BGP)\n") + "redistribute " QUAGGA_REDIST_STR_RIPNGD, + "Redistribute\n" + QUAGGA_REDIST_HELP_STR_RIPNGD) { - int i; + int type; - for(i = 0; redist_type[i].str; i++) + type = proto_redistnum(AFI_IP6, argv[0]); + + if (type < 0) { - if (strncmp (redist_type[i].str, argv[0], - redist_type[i].str_min_len) == 0) - { - zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, redist_type[i].type); - return CMD_SUCCESS; - } + vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE); + return CMD_WARNING; } - vty_out(vty, "Invalid type %s%s", argv[0], - VTY_NEWLINE); - - return CMD_WARNING; + zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, type); + return CMD_SUCCESS; } DEFUN (no_ripng_redistribute_type, no_ripng_redistribute_type_cmd, - "no redistribute (kernel|connected|static|ospf6|bgp)", + "no redistribute " QUAGGA_REDIST_STR_RIPNGD, NO_STR - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Open Shortest Path First (OSPFv3)\n" - "Border Gateway Protocol (BGP)\n") + "Redistribute\n" + QUAGGA_REDIST_HELP_STR_RIPNGD) { - int i; + int type; - for (i = 0; redist_type[i].str; i++) + type = proto_redistnum(AFI_IP6, argv[0]); + + if (type < 0) { - if (strncmp(redist_type[i].str, argv[0], - redist_type[i].str_min_len) == 0) - { - ripng_redistribute_metric_unset (redist_type[i].type); - ripng_redistribute_routemap_unset (redist_type[i].type); - return ripng_redistribute_unset (redist_type[i].type); - } + vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE); + return CMD_WARNING; } - vty_out(vty, "Invalid type %s%s", argv[0], - VTY_NEWLINE); - - return CMD_WARNING; + ripng_redistribute_metric_unset (type); + ripng_redistribute_routemap_unset (type); + return ripng_redistribute_unset (type); } DEFUN (ripng_redistribute_type_metric, ripng_redistribute_type_metric_cmd, - "redistribute (kernel|connected|static|ospf6|bgp) metric <0-16>", - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Open Shortest Path First (OSPFv3)\n" - "Border Gateway Protocol (BGP)\n" + "redistribute " QUAGGA_REDIST_STR_RIPNGD " metric <0-16>", + "Redistribute\n" + QUAGGA_REDIST_HELP_STR_RIPNGD "Metric\n" "Metric value\n") { - int i; + int type; int metric; metric = atoi (argv[1]); + type = proto_redistnum(AFI_IP6, argv[0]); - for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[0], - redist_type[i].str_min_len) == 0) - { - ripng_redistribute_metric_set (redist_type[i].type, metric); - zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, redist_type[i].type); - return CMD_SUCCESS; - } - } - - vty_out(vty, "Invalid type %s%s", argv[0], - VTY_NEWLINE); + if (type < 0) + { + vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE); + return CMD_WARNING; + } - return CMD_WARNING; + ripng_redistribute_metric_set (type, metric); + zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, type); + return CMD_SUCCESS; } ALIAS (no_ripng_redistribute_type, no_ripng_redistribute_type_metric_cmd, - "no redistribute (kernel|connected|static|ospf6|bgp) metric <0-16>", + "no redistribute " QUAGGA_REDIST_STR_RIPNGD " metric <0-16>", NO_STR - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Open Shortest Path First (OSPFv3)\n" - "Border Gateway Protocol (BGP)\n" + "Redistribute\n" + QUAGGA_REDIST_HELP_STR_RIPNGD "Metric\n" "Metric value\n") DEFUN (ripng_redistribute_type_routemap, ripng_redistribute_type_routemap_cmd, - "redistribute (kernel|connected|static|ospf6|bgp) route-map WORD", - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Open Shortest Path First (OSPFv3)\n" - "Border Gateway Protocol (BGP)\n" + "redistribute " QUAGGA_REDIST_STR_RIPNGD " route-map WORD", + "Redistribute\n" + QUAGGA_REDIST_HELP_STR_RIPNGD "Route map reference\n" "Pointer to route-map entries\n") { - int i; + int type; - for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[0], - redist_type[i].str_min_len) == 0) - { - ripng_redistribute_routemap_set (redist_type[i].type, argv[1]); - zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, redist_type[i].type); - return CMD_SUCCESS; - } - } + type = proto_redistnum(AFI_IP6, argv[0]); - vty_out(vty, "Invalid type %s%s", argv[0], - VTY_NEWLINE); + if (type < 0) + { + vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE); + return CMD_WARNING; + } - return CMD_WARNING; + ripng_redistribute_routemap_set (type, argv[1]); + zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, type); + return CMD_SUCCESS; } ALIAS (no_ripng_redistribute_type, no_ripng_redistribute_type_routemap_cmd, - "no redistribute (kernel|connected|static|ospf6|bgp) route-map WORD", + "no redistribute " QUAGGA_REDIST_STR_RIPNGD " route-map WORD", NO_STR - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Open Shortest Path First (OSPFv3)\n" - "Border Gateway Protocol (BGP)\n" + "Redistribute\n" + QUAGGA_REDIST_HELP_STR_RIPNGD "Route map reference\n" "Pointer to route-map entries\n") DEFUN (ripng_redistribute_type_metric_routemap, ripng_redistribute_type_metric_routemap_cmd, - "redistribute (kernel|connected|static|ospf6|bgp) metric <0-16> route-map WORD", - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Open Shortest Path First (OSPFv3)\n" - "Border Gateway Protocol (BGP)\n" + "redistribute " QUAGGA_REDIST_STR_RIPNGD " metric <0-16> route-map WORD", + "Redistribute\n" + QUAGGA_REDIST_HELP_STR_RIPNGD "Metric\n" "Metric value\n" "Route map reference\n" "Pointer to route-map entries\n") { - int i; + int type; int metric; + type = proto_redistnum(AFI_IP6, argv[0]); metric = atoi (argv[1]); - for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[0], - redist_type[i].str_min_len) == 0) - { - ripng_redistribute_metric_set (redist_type[i].type, metric); - ripng_redistribute_routemap_set (redist_type[i].type, argv[2]); - zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, redist_type[i].type); - return CMD_SUCCESS; - } - } - - vty_out(vty, "Invalid type %s%s", argv[0], - VTY_NEWLINE); + if (type < 0) + { + vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE); + return CMD_WARNING; + } - return CMD_WARNING; + ripng_redistribute_metric_set (type, metric); + ripng_redistribute_routemap_set (type, argv[2]); + zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, type); + return CMD_SUCCESS; } ALIAS (no_ripng_redistribute_type, no_ripng_redistribute_type_metric_routemap_cmd, - "no redistribute (kernel|connected|static|ospf6|bgp) metric <0-16> route-map WORD", + "no redistribute " QUAGGA_REDIST_STR_RIPNGD " metric <0-16> route-map WORD", NO_STR - "Redistribute information from another routing protocol\n" - "Kernel routes\n" - "Connected\n" - "Static routes\n" - "Open Shortest Path First (OSPFv3)\n" - "Border Gateway Protocol (BGP)\n" + "Redistribute\n" + QUAGGA_REDIST_HELP_STR_RIPNGD "Route map reference\n" "Pointer to route-map entries\n") -- cgit v1.2.1