bgp / bgpq4

BGP Filter generator
https://github.com/bgp/bgpq4
BSD 2-Clause "Simplified" License
303 stars 43 forks source link

invalid output - mikrotik routeros v7 #102

Closed darshankowlaser closed 1 year ago

darshankowlaser commented 1 year ago

Hello,

I've found a bug that you would possibly like to fix, the output for MikroTik v7 routeros is invalid :

bgpq4 -A -K7l MS AS-MICROSOFT
/routing filter rule add chain="MS-V4" rule="if (dst=1.186.0.0/16) {accept}"
/routing filter rule add chain="MS-V4" rule="if (dst=2.58.103.0/24) {accept}"
/routing filter rule add chain="MS-V4"  rule="if (dst in 4.128.0.0/9 && dst-len in 12-12) {accept}"
/routing filter rule add chain="MS-V4" rule="if (dst=5.23.34.0/24) {accept}"
/routing filter rule add chain="MS-V4" rule="if (dst=8.8.31.0/24) {accept}"
/routing filter rule add chain="MS-V4" rule="if (dst=8.18.31.0/24) {accept}"

This will not import into the router unless an additional "=" is added into the output. Here is the what it should look like :

bgpq4 -A -K7l MS AS-MICROSOFT
/routing filter rule add chain="MS-V4" rule="if (dst==1.186.0.0/16) {accept}"
/routing filter rule add chain="MS-V4" rule="if (dst==2.58.103.0/24) {accept}"
/routing filter rule add chain="MS-V4"  rule="if (dst in 4.128.0.0/9 && dst-len in 12-12) {accept}"
/routing filter rule add chain="MS-V4" rule="if (dst==5.23.34.0/24) {accept}"
/routing filter rule add chain="MS-V4" rule="if (dst==8.8.31.0/24) {accept}"
/routing filter rule add chain="MS-V4" rule="if (dst==8.18.31.0/24) {accept}"

It should be simple to fix easy to implement a fix.

job commented 1 year ago

Thanks! I don’t have mikrotik so hard for me to test.

would you like to try to patch this yourself and make a pull-request?

darshankowlaser commented 1 year ago

sure thing!