summaryrefslogtreecommitdiffstats
path: root/pbrd/pbr_vrf.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* *: cleanup ifp->vrf_idIgor Ryzhov2021-11-221-11/+0
| | | | | | | Since f60a1188 we store a pointer to the VRF in the interface structure. There's no need anymore to store a separate vrf_id field. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* *: require semicolon after DEFINE_MTYPE & coDavid Lamparter2021-03-171-1/+1
| | | | | | | | | | | | | | | | | Back when I put this together in 2015, ISO C11 was still reasonably new and we couldn't require it just yet. Without ISO C11, there is no "good" way (only bad hacks) to require a semicolon after a macro that ends with a function definition. And if you added one anyway, you'd get "spurious semicolon" warnings on some compilers... With C11, `_Static_assert()` at the end of a macro will make it so that the semicolon is properly required, consumed, and not warned about. Consistently requiring semicolons after "file-level" macros matches Linux kernel coding style and helps some editors against mis-syntax'ing these macros. Signed-off-by: David Lamparter <equinox@diac24.net>
* pbrd: Fix memory leakDonald Sharp2020-10-231-0/+12
| | | | | | | | | On shutdown pbr was leaking the ifp->info ( struct pbr_interface *) pointer. Add some code to notice we are being shutdown and cleanup the memory Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* pbrd: Properly hook back up when vrf is destroyed than recreatedDonald Sharp2020-08-281-0/+2
| | | | | | | | | | | | | | | | | Currently when a vrf is deleted than added back in PBR was not going through and touching up all the data structures that needed to be massaged to allow it to start working again. This includes: a) Search through the nexthop groups to find any nexthop that references the old nexthop id and set it right again. b) Search through the nexthop cache for nht and reset those nexthops to the right vrf as well as re-register Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* pbrd: Add `set vrf NAME` and `set vrf unchanged`Stephen Worley2019-11-211-0/+137
`set vrf NAME` allows the pbr map to point to an arbitrary vrf table. `set vrf unchanged` will use the interface's vrf for table lookup. Further, add functionality for pbr to respond to interface events such as interface vrf changes & interface creation/deletion. Ex) ubuntu_nh# show pbr map pbr-map TEST valid: 1 Seq: 1 rule: 300 Installed: 3(1) Reason: Valid SRC Match: 3.3.3.3/32 VRF Unchanged (use interface vrf) pbr-map TEST2 valid: 1 Seq: 2 rule: 301 Installed: 3(2) Reason: Valid SRC Match: 4.4.4.4/32 VRF Lookup: vrf-red root@ubuntu_nh:/home# ip rule show 0: from all lookup local 300: from 3.3.3.3 iif dummy2 lookup main 300: from 3.3.3.3 iif dummyVRF lookup 1111 301: from 4.4.4.4 iif dummy1 lookup 1111 301: from 4.4.4.4 iif dummy3 lookup 1111 Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com-