Mailing List Archive

[PATCH] lib: make IPv6 prefix parser slightly more strict
This makes it possible to have both "show babel route A.B.C.D/M"
and "show babel route X:X::X:X/M" commands at the same time without
the parser complaining about ambiguity.

* lib/command.c: only accept STATE_DOT after : was seen.

Reported-by: Juliusz Chroboczek <jch@pps.jussieu.fr>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
---
Simpler version...

Note that cmd_ipv6_match uses inet_pton on master; I think I might've broken
partly_match support there... need to re-check that.

-David
---
lib/command.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/lib/command.c b/lib/command.c
index 4d95e92..64563b5 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -954,7 +954,12 @@ cmd_ipv6_prefix_match (const char *str)
if (*(str + 1) == ':')
state = STATE_COLON;
else if (*(str + 1) == '.')
- state = STATE_DOT;
+ {
+ if (colons || double_colon)
+ state = STATE_DOT;
+ else
+ return no_match;
+ }
else if (*(str + 1) == '/')
state = STATE_SLASH;
}
--
1.7.8.6

_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
http://lists.quagga.net/mailman/listinfo/quagga-dev
Re: [PATCH] lib: make IPv6 prefix parser slightly more strict [ In reply to ]
> This makes it possible to have both "show babel route A.B.C.D/M"
> and "show babel route X:X::X:X/M" commands at the same time without
> the parser complaining about ambiguity.
>
> * lib/command.c: only accept STATE_DOT after : was seen.

And what about cmd_ipv6_match ?

-- Juliusz
_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
http://lists.quagga.net/mailman/listinfo/quagga-dev
Re: [PATCH] lib: make IPv6 prefix parser slightly more strict [ In reply to ]
On Fri, Jul 20, 2012 at 02:49:33AM +0200, Juliusz Chroboczek wrote:
> > This makes it possible to have both "show babel route A.B.C.D/M"
> > and "show babel route X:X::X:X/M" commands at the same time without
> > the parser complaining about ambiguity.
> >
> > * lib/command.c: only accept STATE_DOT after : was seen.
>
> And what about cmd_ipv6_match ?

I'm looking at it, but since the code was changed inbetween by Roman's
patch (for similar reasons to yours), your patch doesn't apply anymore.

It's on the TODO list, after other stuff from the backlog.

-David