Index: head/net/quagga/files/extra-patch-ospf-nexthop =================================================================== --- head/net/quagga/files/extra-patch-ospf-nexthop (revision 418804) +++ head/net/quagga/files/extra-patch-ospf-nexthop (revision 418805) @@ -1,182 +1,182 @@ --- ospfd/ospf_asbr.c.orig 2016-03-15 23:17:17 UTC +++ ospfd/ospf_asbr.c @@ -122,6 +122,7 @@ ospf_reset_route_map_set_values (struct { values->metric = -1; values->metric_type = -1; + values->nexthop.s_addr = -1; } int --- ospfd/ospf_asbr.h.orig 2016-03-15 23:17:17 UTC +++ ospfd/ospf_asbr.h @@ -27,6 +27,7 @@ struct route_map_set_values { int32_t metric; int32_t metric_type; + struct in_addr nexthop; }; /* Redistributed external information. */ @@ -50,6 +51,7 @@ struct external_info struct route_map_set_values route_map_set; #define ROUTEMAP_METRIC(E) (E)->route_map_set.metric #define ROUTEMAP_METRIC_TYPE(E) (E)->route_map_set.metric_type +#define ROUTEMAP_NEXTHOP(E) (E)->route_map_set.nexthop }; #define OSPF_ASBR_CHECK_DELAY 30 --- ospfd/ospf_lsa.c.orig 2016-03-15 23:17:17 UTC +++ ospfd/ospf_lsa.c @@ -1644,7 +1644,8 @@ ospf_external_lsa_body_set (struct strea stream_put_ospf_metric (s, mvalue); /* Get forwarding address to nexthop if on the Connection List, else 0. */ - fwd_addr = ospf_external_lsa_nexthop_get (ospf, ei->nexthop); + fwd_addr = (ei->route_map_set.nexthop.s_addr != -1) ? + ROUTEMAP_NEXTHOP (ei) : ospf_external_lsa_nexthop_get (ospf, ei->nexthop); /* Put forwarding address. */ stream_put_ipv4 (s, fwd_addr.s_addr); --- ospfd/ospf_routemap.c.orig 2016-03-15 23:17:17 UTC +++ ospfd/ospf_routemap.c @@ -531,6 +531,62 @@ struct route_map_rule_cmd route_set_metr route_set_metric_type_free, }; +/* `set ip next-hop IP_ADDRESS' */ +/* Set nexthop to object. */ +static route_map_result_t +route_set_ip_nexthop (void *rule, struct prefix *prefix, + route_map_object_t type, void *object) +{ + struct in_addr *address; + struct external_info *ei; + + if (type == RMAP_OSPF) + { + /* Fetch routemap's rule information. */ + address = rule; + ei = object; + + /* Set metric out value. */ + ei->route_map_set.nexthop = *address; + } + return RMAP_OKAY; +} + +/* set ip next-hop compilation. */ +static void * +route_set_ip_nexthop_compile (const char *arg) +{ + struct in_addr *address = NULL; + int ret; + + address = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct in_addr)); + ret = inet_aton (arg, address); + + if (ret == 0) + { + XFREE (MTYPE_ROUTE_MAP_COMPILED, address); + return NULL; + } + + return address; +} + +/* Free route map's compiled `set ip next-hop' value. */ +static void +route_set_ip_nexthop_free (void *rule) +{ + XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); +} + +/* Set ip next-hop rule structure. */ +struct route_map_rule_cmd route_set_ip_nexthop_cmd = +{ + "ip next-hop", + route_set_ip_nexthop, + route_set_ip_nexthop_compile, + route_set_ip_nexthop_free, +}; + DEFUN (match_ip_nexthop, match_ip_nexthop_cmd, "match ip next-hop (<1-199>|<1300-2699>|WORD)", @@ -785,6 +841,49 @@ ALIAS (no_set_metric_type, "OSPF[6] external type 1 metric\n" "OSPF[6] external type 2 metric\n") +DEFUN (set_ip_nexthop, + set_ip_nexthop_cmd, + "set ip next-hop A.B.C.D", + SET_STR + IP_STR + "Next hop address\n" + "IP address of next hop\n") +{ + union sockunion su; + int ret; + + ret = str2sockunion (argv[0], &su); + if (ret < 0) + { + vty_out (vty, "%% Malformed Next-hop address%s", VTY_NEWLINE); + return CMD_WARNING; + } + + return ospf_route_set_add (vty, vty->index, "ip next-hop", argv[0]); +} + +DEFUN (no_set_ip_nexthop, + no_set_ip_nexthop_cmd, + "no set ip next-hop", + NO_STR + SET_STR + "Next hop address\n") +{ + if (argc == 0) + return ospf_route_set_delete (vty, vty->index, "ip next-hop", NULL); + + return ospf_route_set_delete (vty, vty->index, "ip next-hop", argv[0]); +} + +ALIAS (no_set_ip_nexthop, + no_set_ip_nexthop_val_cmd, + "no set ip next-hop A.B.C.D", + NO_STR + SET_STR + IP_STR + "Next hop address\n" + "IP address of next hop\n") + /* Route-map init */ void ospf_route_map_init (void) @@ -804,6 +903,7 @@ ospf_route_map_init (void) route_map_install_set (&route_set_metric_cmd); route_map_install_set (&route_set_metric_type_cmd); + route_map_install_set (&route_set_ip_nexthop_cmd); install_element (RMAP_NODE, &match_ip_nexthop_cmd); install_element (RMAP_NODE, &no_match_ip_nexthop_cmd); @@ -827,4 +927,7 @@ ospf_route_map_init (void) install_element (RMAP_NODE, &set_metric_type_cmd); install_element (RMAP_NODE, &no_set_metric_type_cmd); install_element (RMAP_NODE, &no_set_metric_type_val_cmd); + install_element (RMAP_NODE, &set_ip_nexthop_cmd); + install_element (RMAP_NODE, &no_set_ip_nexthop_cmd); + install_element (RMAP_NODE, &no_set_ip_nexthop_val_cmd); } ---- vtysh/extract.pl.orig 2016-07-19 14:12:32 UTC -+++ vtysh/extract.pl +--- vtysh/extract.pl.in.orig 2016-03-15 23:17:17 UTC ++++ vtysh/extract.pl.in @@ -180,7 +180,7 @@ foreach (@ARGV) { } } -my $bad_cli_stomps = 89; +my $bad_cli_stomps = 92; # Currently we have $bad_cli_stomps. This was determined by # running this script and counting up the collisions from what # was returned. Index: head/net/quagga/pkg-plist =================================================================== --- head/net/quagga/pkg-plist (revision 418804) +++ head/net/quagga/pkg-plist (revision 418805) @@ -1,99 +1,99 @@ %%PIMD%%bin/test_igmpv3_join bin/vtysh bin/bgp_btoa include/quagga/buffer.h include/quagga/checksum.h include/quagga/command.h include/quagga/distribute.h include/quagga/fifo.h include/quagga/filter.h include/quagga/getopt.h include/quagga/hash.h include/quagga/if.h include/quagga/if_rmap.h include/quagga/jhash.h include/quagga/keychain.h include/quagga/libospf.h include/quagga/linklist.h include/quagga/log.h include/quagga/md5.h include/quagga/memory.h include/quagga/memtypes.h include/quagga/network.h -%%OSPF_OPAQUE_LSA%%include/quagga/ospfapi/ospf_apiclient.h +include/quagga/ospfapi/ospf_apiclient.h include/quagga/ospfd/ospf_api.h include/quagga/ospfd/ospf_asbr.h include/quagga/ospfd/ospf_dump.h include/quagga/ospfd/ospf_ism.h include/quagga/ospfd/ospf_lsa.h include/quagga/ospfd/ospf_lsdb.h include/quagga/ospfd/ospf_nsm.h include/quagga/ospfd/ospf_opaque.h include/quagga/ospfd/ospfd.h include/quagga/plist.h include/quagga/pqueue.h include/quagga/prefix.h include/quagga/privs.h include/quagga/route_types.h include/quagga/routemap.h include/quagga/sigevent.h include/quagga/smux.h include/quagga/sockopt.h include/quagga/sockunion.h include/quagga/str.h include/quagga/stream.h include/quagga/table.h include/quagga/thread.h include/quagga/vector.h include/quagga/version.h include/quagga/vrf.h include/quagga/vty.h include/quagga/workqueue.h include/quagga/zassert.h include/quagga/zclient.h include/quagga/zebra.h lib/libospf.a lib/libospf.so lib/libospf.so.0 lib/libospf.so.0.0.0 -%%OSPF_OPAQUE_LSA%%lib/libospfapiclient.a -%%OSPF_OPAQUE_LSA%%lib/libospfapiclient.so -%%OSPF_OPAQUE_LSA%%lib/libospfapiclient.so.0 -%%OSPF_OPAQUE_LSA%%lib/libospfapiclient.so.0.0.0 +lib/libospfapiclient.a +lib/libospfapiclient.so +lib/libospfapiclient.so.0 +lib/libospfapiclient.so.0.0.0 lib/libzebra.a lib/libzebra.so lib/libzebra.so.0 lib/libzebra.so.0.0.0 man/man1/vtysh.1.gz man/man8/bgpd.8.gz %%ISISD%%man/man8/isisd.8.gz man/man8/ospf6d.8.gz -%%OSPF_OPAQUE_LSA%%man/man8/ospfclient.8.gz +man/man8/ospfclient.8.gz man/man8/ospfd.8.gz %%PIMD%%man/man8/pimd.8.gz man/man8/ripd.8.gz man/man8/ripngd.8.gz man/man8/watchquagga.8.gz man/man8/zebra.8.gz sbin/bgpd %%ISISD%%sbin/isisd sbin/ospf6d -%%OSPF_OPAQUE_LSA%%sbin/ospfclient +sbin/ospfclient sbin/ospfd %%PIMD%%sbin/pimd sbin/ripd sbin/ripngd sbin/watchquagga sbin/zebra %%EXAMPLESDIR%%/bgpd.conf.sample %%EXAMPLESDIR%%/bgpd.conf.sample2 %%ISISD%%%%EXAMPLESDIR%%/isisd.conf.sample %%EXAMPLESDIR%%/ospf6d.conf.sample %%EXAMPLESDIR%%/ospfd.conf.sample %%PIMD%%%%PORTEXAMPLES%%%%EXAMPLESDIR%%/pimd.conf.sample %%EXAMPLESDIR%%/ripd.conf.sample %%EXAMPLESDIR%%/ripngd.conf.sample %%EXAMPLESDIR%%/vtysh.conf.sample %%EXAMPLESDIR%%/zebra.conf.sample @dir(%%ENABLE_USER%%,%%ENABLE_GROUP%%,750) %%LOCALSTATE_DIR%% @dir(%%ENABLE_USER%%,%%ENABLE_GROUP%%,750) %%SYSCONF_DIR%%