summaryrefslogtreecommitdiffstats
path: root/ripd/rip_routemap.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* *: Fix spelling of ojbectDonald Sharp2022-04-021-2/+2
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Remove route_map_object_t from the systemDonald Sharp2020-11-141-141/+103
| | | | | | | | | | | | | The route_map_object_t was being used to track what protocol we were being called against. But each protocol was only ever calling itself. So we had a variable that was only ever being passed in from route_map_apply that had to be carried against and everyone was testing if that variable was for their own stack. Clean up this route_map_object_t from the entire system. We should speed some stuff up. Yes I know not a bunch but this will add up. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__Donatas Abraitis2020-03-051-1/+1
| | | | | | Just keep the code cool. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* *: Replace s_addr 0 => INADDR_ANYDonatas Abraitis2020-02-061-4/+6
| | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* *: make all route_map_rule_cmd constDavid Lamparter2019-11-301-31/+62
| | | | Signed-off-by: David Lamparter <equinox@diac24.net>
* lib: Introducing a 3rd state for route-map match cmd: RMAP_NOOPLakshman Krishnamoorthy2019-07-221-32/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introducing a 3rd state for route_map_apply library function: RMAP_NOOP Traditionally route map MATCH rule apis were designed to return a binary response, consisting of either RMAP_MATCH or RMAP_NOMATCH. (Route-map SET rule apis return RMAP_OKAY or RMAP_ERROR). Depending on this response, the following statemachine decided the course of action: State1: If match cmd returns RMAP_MATCH then, keep existing behaviour. If routemap type is PERMIT, execute set cmds or call cmds if applicable, otherwise PERMIT! Else If routemap type is DENY, we DENYMATCH right away State2: If match cmd returns RMAP_NOMATCH, continue on to next route-map. If there are no other rules or if all the rules return RMAP_NOMATCH, return DENYMATCH We require a 3rd state because of the following situation: The issue - what if, the rule api needs to abort or ignore a rule?: "match evpn vni xx" route-map filter can be applied to incoming routes regardless of whether the tunnel type is vxlan or mpls. This rule should be N/A for mpls based evpn route, but applicable to only vxlan based evpn route. Also, this rule should be applicable for routes with VNI label only, and not for routes without labels. For example, type 3 and type 4 EVPN routes do not have labels, so, this match cmd should let them through. Today, the filter produces either a match or nomatch response regardless of whether it is mpls/vxlan, resulting in either permitting or denying the route.. So an mpls evpn route may get filtered out incorrectly. Eg: "route-map RM1 permit 10 ; match evpn vni 20" or "route-map RM2 deny 20 ; match vni 20" With the introduction of the 3rd state, we can abort this rule check safely. How? The rules api can now return RMAP_NOOP to indicate that it encountered an invalid check, and needs to abort just that rule, but continue with other rules. As a result we have a 3rd state: State3: If match cmd returned RMAP_NOOP Then, proceed to other route-map, otherwise if there are no more rules or if all the rules return RMAP_NOOP, then, return RMAP_PERMITMATCH. Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
* Revert "Ospf missing interface handling 2"Donald Sharp2019-06-241-2/+1
|
* Merge pull request #3775 from pguibert6WIND/ospf_missing_interface_handling_2Donald Sharp2019-06-221-1/+2
|\ | | | | Ospf missing interface handling 2
| * *: change if_lookup_by_name() api with vrfPhilippe Guibert2019-06-121-1/+2
| | | | | | | | | | | | | | | | | | | | the vrf_id parameter is replaced by struct vrf * parameter. this impacts most of the daemons that look for an interface based on the name and the vrf identifier. Also, it fixes 2 lookup calls in zebra and sharpd, where the vrf_id was ignored until now. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* | rmap: Add hooks into zebra,ospf,rip for `match ip next-hop type blackhole`Donatas Abraitis2019-06-211-0/+38
|/ | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* Revert of PR 4078 and PR 4315Lakshman Krishnamoorthy2019-06-041-24/+27
| | | | Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
* lib: Introducing a 3rd state for route-map match cmd: RMAP_NOOPLakshman Krishnamoorthy2019-05-301-27/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introducing a 3rd state for route_map_apply library function: RMAP_NOOP Traditionally route map MATCH rule apis were designed to return a binary response, consisting of either RMAP_MATCH or RMAP_NOMATCH. (Route-map SET rule apis return RMAP_OKAY or RMAP_ERROR). Depending on this response, the following statemachine decided the course of action: Action: Apply route-map match and return the result (RMAP_MATCH/RMAP_NOMATCH) State1: Receveived RMAP_MATCH THEN: If Routemap type is PERMIT, execute other rules if applicable, otherwise we PERMIT! Else: If Routemap type is DENY, we DENYMATCH right away State2: Received RMAP_NOMATCH, continue on to next route-map, otherwise, return DENYMATCH by default if nothing matched. With reference to PR 4078 (https://github.com/FRRouting/frr/pull/4078), we require a 3rd state because of the following situation: The issue - what if, the rule api needs to abort or ignore a rule?: "match evpn vni xx" route-map filter can be applied to incoming routes regardless of whether the tunnel type is vxlan or mpls. This rule should be N/A for mpls based evpn route, but applicable to only vxlan based evpn route. Today, the filter produces either a match or nomatch response regardless of whether it is mpls/vxlan, resulting in either permitting or denying the route.. So an mpls evpn route may get filtered out incorrectly. Eg: "route-map RM1 permit 10 ; match evpn vni 20" or "route-map RM2 deny 20 ; match vni 20" With the introduction of the 3rd state, we can abort this rule check safely. How? The rules api can now return RMAP_NOOP (or another enum) to indicate that it encountered an invalid check, and needs to abort just that rule, but continue with other rules. Question: Do we repurpose an existing enum RMAP_OKAY or RMAP_ERROR as the 3rd state (or create a new enum like RMAP_NOOP)? RMAP_OKAY and RMAP_ERROR are used to return the result of set cmd. We chose to go with RMAP_NOOP (but open to ideas), as a way to bypass the rmap filter As a result we have a 3rd state: State3: Received RMAP_NOOP Then, proceed to other route-map, otherwise return RMAP_PERMITMATCH by default. Signed-off-by:Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
* Treewide: use ANSI function definitionsRuben Kerkhof2019-01-241-1/+1
| | | | Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
* ripd: remove leftovers from the old sighup handlerRenato Westphal2018-12-031-5/+0
| | | | | | | | Commit bc1bdde2f6 removed the rip_reset() function but didn't remove other functions that were only called by rip_reset(). Remove them now (dead code). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* ripd: retrofit the 'redistribute' commands to the new northbound modelRenato Westphal2018-10-271-19/+0
| | | | | | | | | | | | | | | | Trivial conversion. As usual, combine multiple DEFUNs into a single DEFPY for simplicity. As a bonus of the northbound conversion, this commit fixes the redistribution of certain protocols into ripd. The 'redist_type' array used by the "redistribute" commands was terribly outdated, which was preventing the CLI to parse correctly certain protocols like isis and babel. Remove the route_map hooks installed by rip_route_map_init() since they were redundant (rip_init() already takes care of that). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* libs, daemons: use const in route-map applyMark Stapp2018-07-231-10/+12
| | | | | | | Use 'const prefix *' in route-map apply apis; led to some corresponding changes in several daemons. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* *: use C99 standard fixed-width integer typesQuentin Young2018-03-271-5/+5
| | | | | | | | | | | | | | | | | | | | | | The following types are nonstandard: - u_char - u_short - u_int - u_long - u_int8_t - u_int16_t - u_int32_t Replace them with the C99 standard types: - uint8_t - unsigned short - unsigned int - unsigned long - uint8_t - uint16_t - uint32_t Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: conform with COMMUNITY.md formatting rules, via 'make indent'Lou Berger2018-03-061-8/+7
| | | | Signed-off-by: Lou Berger <lberger@labn.net>
* ripd: Convert to using 'struct nexthop' for nexthop informationDonald Sharp2017-11-161-3/+5
| | | | | | | | | | | RIP is not using the nexthop data structure and as such when it does not fully understand when it receives some of the more exotic nexthop types what to do with it. This is the start of a series of commits to allow RIP to start understanding and properly displaying information about different nexthop types. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* ripd: Fix warning about metric value less than 0Donald Sharp2017-09-051-2/+1
| | | | | | | | | | | | | RIP is testing to ensure that the metric returned isn't negative. We should be looking at the returned value from the cli strtol. If we get a metric value that is less than zero that means that we shouldn't use this value in RIP currently. So signify that by returning mod here. Fixes: #1107 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib, ospfd, ripd, ripngd: Fix 'set metric'Donald Sharp2017-08-291-16/+25
| | | | | | | | | | | | | | | | | | | There are a variety of cli's associated with the 'set metric ...' command. The problem that we are experiencing is that not all the daemons support all the varieties of the set metric and the returned of NULL during the XXX_compile phase for these unsupported commands is causing issues. Modify the code base to only return NULL if we encounter a true parsing issue. Else we need to keep track if this metric applies to us or not. In the case of rip or ripngd if the metric passed to us is greater than 16 just turn it internally into a MAX_METRIC. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Revert "*: reindent pt. 2"David Lamparter2017-07-221-6/+2
| | | | | | | | | This reverts commit c14777c6bfd0a446c85243d3a9835054a259c276. clang 5 is not widely available enough for people to indent with. This is particularly problematic when rebasing/adjusting branches. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: reindent pt. 2whitespace / reindent2017-07-171-2/+6
| | | | | | | | w/ clang 5 * reflow comments * struct members go 1 per line * binpack algo was adjusted
* *: reindentreindent-master-afterwhitespace / reindent2017-07-171-426/+358
| | | | | | indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: make consistent & update GPLv2 file headersDavid Lamparter2017-05-151-4/+3
| | | | | | | | | | | The FSF's address changed, and we had a mixture of comment styles for the GPL file header. (The style with * at the beginning won out with 580 to 141 in existing files.) Note: I've intentionally left intact other "variations" of the copyright header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: Refactor if_lookup_by_name to be VRF awareDonald Sharp2017-03-151-1/+2
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Merge branch 'cmaster-next' into vtysh-grammarQuentin Young2016-10-201-1/+1
|\ | | | | | | | | | | | | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com> Conflicts: isisd/isis_routemap.c zebra/rt_netlink.c
| * *: Consolidate routemap initializationDonald Sharp2016-10-191-1/+1
| | | | | | | | | | | | | | | | Consolidate the routemap initialization into one function. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
* | Merge branch 'cmaster-next' into vtysh-grammarQuentin Young2016-10-181-60/+10
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com> Conflicts: bgpd/bgp_route.c bgpd/bgp_routemap.c bgpd/bgp_vty.c isisd/isis_redist.c isisd/isis_routemap.c isisd/isis_vty.c isisd/isisd.c lib/command.c lib/distribute.c lib/if.c lib/keychain.c lib/routemap.c lib/routemap.h ospf6d/ospf6_asbr.c ospf6d/ospf6_interface.c ospf6d/ospf6_neighbor.c ospf6d/ospf6_top.c ospf6d/ospf6_zebra.c ospf6d/ospf6d.c ospfd/ospf_routemap.c ospfd/ospf_vty.c ripd/rip_routemap.c ripngd/ripng_routemap.c vtysh/extract.pl.in vtysh/vtysh.c zebra/interface.c zebra/irdp_interface.c zebra/rt_netlink.c zebra/rtadv.c zebra/test_main.c zebra/zebra_routemap.c zebra/zebra_vty.c
| * *: Consistently support 32-bit route tagsChristian Franke2016-10-081-64/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch improves zebra,ripd,ripngd,ospfd and bgpd so that they can make use of 32-bit route tags in the case of zebra,ospf,bgp or 16-bit route-tags in the case of ripd,ripngd. It is based on the following patch: commit d25764028829a3a30cdbabe85f32408a63cccadf Author: Paul Jakma <paul.jakma@hpe.com> Date: Fri Jul 1 14:23:45 2016 +0100 *: Widen width of Zserv routing tag field. But also contains the changes which make this actually useful for all the daemons. Signed-off-by: Christian Franke <chris@opensourcerouting.org>
* | all: removed all DEFUN command stompsDaniel Walton2016-10-061-402/+31
| | | | | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | all: scrubbed some argc CHECK MEsDaniel Walton2016-09-291-9/+0
| | | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
* | all: added CHECK ME for DEFUNs that look at argcDaniel Walton2016-09-291-0/+9
| | | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
* | ripd: argv not argcQuentin Young2016-09-271-1/+1
| | | | | | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | ripd: resolve rip_routemap.c CHECK ME'sQuentin Young2016-09-271-155/+62
| | | | | | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | ripd: add 'int idx_foo' argv index variablesDaniel Walton2016-09-231-11/+21
| | | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
* | convert <1-255> to (1-255), ()s to <>s, etcDaniel Walton2016-09-231-6/+6
| | | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
* | ALIAS removal for bgp, ospf, pim, isis, rip, ripng, lib and zebraDaniel Walton2016-09-231-110/+119
| | | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
* | ripd: argv updateDaniel Walton2016-09-231-51/+21
| | | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
* | Revert "ripd: Fixup code to work under new way"Daniel Walton2016-09-221-21/+21
| | | | | | | | This reverts commit 224a3ed809ae23539cd49b85ada8516cb0b0a762.
* | ripd: Fixup code to work under new wayDonald Sharp2016-09-211-21/+21
|/
* When a route-map configuration is used to set the nexthop to a value, makeDonald Sharp2015-06-111-0/+7
| | | | | | sure that the value is acceptable. For example, if the route-map is setting the IPv6 link-local nexthop, make sure the value is an IPv6 link-local address.
* 'set metric -12' is broken in the parserDonald Sharp2015-05-201-8/+8
| | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
* Add support for route tagsDonald Sharp2015-05-201-5/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix "no set metric" for ospf6 and RIPDonald Sharp2015-05-201-2/+10
| | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
* *: nuke ^L (page feed)David Lamparter2014-06-041-7/+7
| | | | | | | | | | | | | | Quagga sources have inherited a slew of Page Feed (^L, \xC) characters from ancient history. Among other things, these break patchwork's XML-RPC API because \xC is not a valid character in XML documents. Nuke them from high orbit. Patches can be adapted simply by: sed -e 's%^L%%' -i filename.patch (you can type page feeds in some environments with Ctrl-V Ctrl-L) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* [ripd] bug #293: routemap set metric doesn't check for underflow correctlyPaul Jakma2006-09-111-1/+1
| | | | | | | | 2006-09-11 Paul Jakma <paul.jakma@sun.com> * rip_routemap.c: (route_set_metric) underflow check needs to use signed, problem identified and diagnosed by Pavel Nikiforov in bug #293.
* 2005-10-26 Paul Jakma <paul.jakma@sun.com>paul2005-10-261-42/+42
| | | | | | * (general) static/extern functions and definitions. * rip_interface.h: new file, export the public functions from rip_interface.c
* 2005-09-29 Alain Ritoux <alain.ritoux@6wind.com>vincent2005-09-291-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | * lib/filer.c: show protocol name in filter_show() * lib/plist.c: show protocol name in vty_show_prefix_entry() * routemap.c: show protocol name in vty_show_route_map_entry() * lib/vty.c: in vty_command(), show protocol name if command unknown * zebra/zserv.c: Always provide distance fo route add * ripd/rip_snmp.c: rip2IfConfReceive() sends values in conformance with RFC. Also PeerDomain is now set to a STRING type. * ripd/ripd.h: rip_redistribute_add() API includes metric and distance * ripd/ripd.c: rip_redistribute_add() API i.e. stores metric and distance Now allows a RIP-route to overcome a redistributed route coming from a protocol with worse (higher) administrative distance Metrics from redistribution are shown in show ip rip * ripd/rip_zebra.c: adapt to the rip_redistribute_add() API, i.e. provide distance and metric * ripd/rip_interface.c: adapt to the rip_redistribute_add() API * ripd/rip_routemap.c: no RMAP_COMPILE_ERROR on (metric > 16) usage rather a CMD_WARNING, because set metric ius shared with other protocols using larger values (such as OSPF) The match metric action takes first external metric if present (from redistribution) then RIP metric.
* Sync bgpd and ripd set_metric_addsub_cmd commands. Fixes bugzilla #192.hasso2005-05-281-1/+1
| | | | [backport candidate]