]> git.proxmox.com Git - mirror_frr.git/commit
bgpd: Add lua match command
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 7 Nov 2017 14:14:32 +0000 (09:14 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 27 Sep 2018 01:21:23 +0000 (21:21 -0400)
commit1d7c7ace3c08fd1986143f37063114594fb91069
tree1b5b0c476375dfeb00f3b0be0167f9911a8734c7
parent634949aef8ffbd504fe6337a4668de4b9b8b3941
bgpd: Add lua match command

Please note this is a Proof of Concept and not actually something
that is ready to commit at this point.  The file tools/lua.scr
contains some documentation on how we expect it to work currently.
Additionally not all bgp values have been hooked up into the
ability to lua script yet.

There is still significant work to be done here:

1) Add the ability to pass in more data and to adjust the return values
as appropriate.

To set it up:

1) copy tools/lua.scr into /etc/frr (or whereever the config
directory is )

2) Create a route-map match command:
!
router bgp 55
 neighbor 10.50.11.116 remote-as external
 !
 address-family ipv4 unicast
  neighbor 10.50.11.116 route-map TEST in
 exit-address-family
!
route-map TEST permit 10
 match command mooey
!

3) In the lua.scr file make sure that you have a function
named 'mooey' ( as the above example does ):

function mooey ()
   zlog_debug(string.format("Family: %d: %s %d ifindex: %d aspath: %s localpref: %d",
                            prefix.family, prefix.route,
    nexthop.metric, nexthop.ifindex, nexthop.aspath, nexthop.localpref))

   nexthop.metric =  33
   nexthop.localpref = 13
   return 3
end

This example script modifies the metric and localpref currently.  I've also provided
a zlog_debug function in lua to allow some simple debugging.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
bgpd/bgp_routemap.c
tools/lua.scr [new file with mode: 0644]