diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2015-05-20 02:46:33 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2015-05-20 02:46:33 +0200 |
commit | 0d9551dc3c53f2d46e3c0e3ecb4e4b0eb327179e (patch) | |
tree | f8bf3ba86e81b823af3fcb6fcf1f4fbe77c0b167 /ripd/rip_routemap.c | |
parent | bgpd-fix-nexthop-show.patch (diff) | |
download | frr-0d9551dc3c53f2d46e3c0e3ecb4e4b0eb327179e.tar.xz frr-0d9551dc3c53f2d46e3c0e3ecb4e4b0eb327179e.zip |
Add support for route tags
Credit
------
A huge amount of credit for this patch goes to Piotr Chytla for
their 'route tags support' patch that was submitted to quagga-dev
in June 2007.
Documentation
-------------
All ipv4 and ipv6 static route commands now have a "tag" option
which allows the user to set a tag between 1 and 65535.
quagga(config)# ip route 1.1.1.1/32 10.1.1.1 tag ?
<1-65535> Tag value
quagga(config)# ip route 1.1.1.1/32 10.1.1.1 tag 40
quagga(config)#
quagga# show ip route 1.1.1.1/32
Routing entry for 1.1.1.1/32
Known via "static", distance 1, metric 0, tag 40, best
* 10.1.1.1, via swp1
quagga#
The route-map parser supports matching on tags and setting tags
!
route-map MATCH_TAG_18 permit 10
match tag 18
!
!
route-map SET_TAG_22 permit 10
set tag 22
!
BGP and OSPF support:
- matching on tags when redistribing routes from the RIB into BGP/OSPF.
- setting tags when redistribing routes from the RIB into BGP/OSPF.
BGP also supports setting a tag via a table-map, when installing BGP
routes into the RIB.
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Diffstat (limited to 'ripd/rip_routemap.c')
-rw-r--r-- | ripd/rip_routemap.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/ripd/rip_routemap.c b/ripd/rip_routemap.c index 9bafdcde1..cc0ed61ff 100644 --- a/ripd/rip_routemap.c +++ b/ripd/rip_routemap.c @@ -485,9 +485,22 @@ static void * route_match_tag_compile (const char *arg) { u_short *tag; + u_short tmp; + + /* tag value shoud be integer. */ + if (! all_digit (arg)) + return NULL; + + tmp = atoi(arg); + if (tmp < 1) + return NULL; tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_short)); - *tag = atoi (arg); + + if (!tag) + return tag; + + *tag = tmp; return tag; } @@ -937,7 +950,7 @@ ALIAS (no_match_ip_address_prefix_list, DEFUN (match_tag, match_tag_cmd, - "match tag <0-65535>", + "match tag <1-65535>", MATCH_STR "Match tag of route\n" "Metric value\n") @@ -960,7 +973,7 @@ DEFUN (no_match_tag, ALIAS (no_match_tag, no_match_tag_val_cmd, - "no match tag <0-65535>", + "no match tag <1-65535>", NO_STR MATCH_STR "Match tag of route\n" @@ -1060,7 +1073,7 @@ ALIAS (no_set_ip_nexthop, DEFUN (set_tag, set_tag_cmd, - "set tag <0-65535>", + "set tag <1-65535>", SET_STR "Tag value for routing protocol\n" "Tag value\n") @@ -1083,7 +1096,7 @@ DEFUN (no_set_tag, ALIAS (no_set_tag, no_set_tag_val_cmd, - "no set tag <0-65535>", + "no set tag <1-65535>", NO_STR SET_STR "Tag value for routing protocol\n" |