Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regexp characters: ^ $parameter _ does not work on Quagga router #91

Open
marzdgzmn opened this issue Aug 30, 2019 · 4 comments
Open

regexp characters: ^ $parameter _ does not work on Quagga router #91

marzdgzmn opened this issue Aug 30, 2019 · 4 comments
Assignees
Labels

Comments

@marzdgzmn
Copy link

The current regexp characters used for protected function build_as() function does not work.
Current Code:
https://github.com/respawner/looking-glass/blob/master/routers/quagga.php#L62

The previous code does:

case 'as':
if (match_as($parameter)) {
if (!$this->config['disable_ipv6']) {
$commands[] = $vtysh.'show ipv6 bgp regexp _'.$parameter.'$'.'"';
}
if (!$this->config['disable_ipv4']) {
$commands[] = $vtysh.'show ip bgp regexp _'.$parameter.'$'.'"';
}
} else {
throw new Exception('The parameter is not an AS number.');
}
break;

I tested ^$AS_NUMBER$, but it doesn't seem to also work.
I'm not entirely sure why, but perhaps the $AS_NUMBER is not in the beginning of the string to be captured by ^. Also, it must be in the end as it is capture by $(previous code) and not _(current code).

@gmazoyer
Copy link
Owner

Based on the Quagga documentation the regexp seems to be the right one.

The idea behind the "AS" command is to display BGP route coming from a given ASN. So if my understanding is correct the regexp should be ^12345_. Meaning AS path starting with the ASN followed by anything else.

Reading the Quagga doc though made me wondering if the proper regexp would ^12345.*. I cannot test it though. So if you want to give it a try feel free to do so.

@gmazoyer gmazoyer self-assigned this Aug 31, 2019
@gmazoyer gmazoyer added the bug label Aug 31, 2019
@gmazoyer gmazoyer changed the title regexp characters: ^ $paramter _ does not work on Quagga router regexp characters: ^ $parameter _ does not work on Quagga router Aug 31, 2019
@marzdgzmn
Copy link
Author

marzdgzmn commented Sep 3, 2019

Based on the Quagga documentation the regexp seems to be the right one.

The idea behind the "AS" command is to display BGP route coming from a given ASN. So if my understanding is correct the regexp should be ^12345_. Meaning AS path starting with the ASN followed by anything else.

Reading the Quagga doc though made me wondering if the proper regexp would ^12345.*. I cannot test it though. So if you want to give it a try feel free to do so.

We're using Quagga (version 0.99.24.1).
Tested both:
show ip bgp regexp ^15169_
show ipv6 bgp regexp ^15169.*
Doesn't seem to work.
Our current Looking Glass version is using the one with _15169$ and it is working. You can check it out at lg.rise.ph

Cheers,

@gmazoyer
Copy link
Owner

gmazoyer commented Sep 3, 2019

_15169$ will return routes where 15169 is the last ASN in the AS path. However ^15169_ and ^15169.* will return routes where 15169 is the first ASN in the AS path (which is the wanted behavior).

So I guess this issue is more about what we are expecting from the command. Maybe this command should be a shortcut to *.15169.* which will return all routes containing 15169in the AS path.

@gmazoyer gmazoyer added question and removed bug labels Sep 3, 2019
@marzdgzmn
Copy link
Author

_15169$ will return routes where 15169 is the last ASN in the AS path. However ^15169_ and ^15169.* will return routes where 15169 is the first ASN in the AS path (which is the wanted behavior).

So I guess this issue is more about what we are expecting from the command. Maybe this command should be a shortcut to *.15169.* which will return all routes containing 15169in the AS path.

Since the command specifically states ORIGIN_AS, it should match the last AS in the path. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants