Giter VIP home page Giter VIP logo

Comments (9)

troglobit avatar troglobit commented on July 19, 2024

Good catch, this is a really old code base! The current regexp in cftoken.l looks like this:

ifname		[a-zA-Z]+[0-9]+

Any input on how to improve it is welcome.

from pim6sd.

troglobit avatar troglobit commented on July 19, 2024

How about this? This would also work with new "predictable" interface names from systemd, e.g. enp0s25.

ifname          [a-zA-Z][a-zA-Z0-9_-]*

from pim6sd.

mweinelt avatar mweinelt commented on July 19, 2024

This is probably tricky to get absolutely right if we don't find the limitations in the given network stacks.

On Linux even 0 would be a valid interface name.

9: 0: <BROADCAST,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/ether ba:df:9b:91:f8:1f brd ff:ff:ff:ff:ff:ff

And -:

10: -: <BROADCAST,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/ether 5e:e0:56:eb:5a:b8 brd ff:ff:ff:ff:ff:ff

Heck, even hanky is a valid interface name.

12: 💩: <BROADCAST,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/ether c6:d8:3a:a7:35:1a brd ff:ff:ff:ff:ff:ff

from pim6sd.

mweinelt avatar mweinelt commented on July 19, 2024

All weird interface names that are possible aside, I think a dot followed by numbers is vital for VLAN interfaces (like enp2s0.100).

from pim6sd.

mweinelt avatar mweinelt commented on July 19, 2024

Replacing the regex does not seem to be enough to make it accept the syntax.

from pim6sd.

troglobit avatar troglobit commented on July 19, 2024

Uh, not sure it's even possible to support all the weird variants there ... but I guess any string that doesn't have whitespace is the least worst guess.

Yeah I noticed this right now, changing the regex doesn't bite and the parser just says error, very annoying. I'll see what I can do after work today to enable debug of the parser. No luck so far, but it should be fixable.

from pim6sd.

troglobit avatar troglobit commented on July 19, 2024

I've just pushed what I have in my patch queue. There's one commit that enables the built-in .conf parse debugger, activated when you run pim6sd -n -d all -c file.conf

I'll have a closer look at this mystery tonight. Thank you for the reports so far! :)

from pim6sd.

mweinelt avatar mweinelt commented on July 19, 2024

It seems to try and tokenize br and lan separately.

/usr/src/pim6sd/src/pim6sd -d all -c ../pim6sd.conf
debug level 0xffffffffffffffff (mld_proto,mld_timer,mld_member,switch,trace,timeout,pkt,interfaces,kernel,cache,rsrr,pim_detail,pim_hello,pim_register,pim_join_prune,pim_bootstrap,pim_asserts,pim_cand_rp,pim_routes,pim_timers,pim_rpf)
<3>comment [#The timer granularity.] (23)
<3>comment [#More this value is small,more pim6sd will be accurate ] (55)
<3>comment [#default if not specified : 5] (29)
<3>comment [#BE SURE to have to same granularity on ALL routers,] (52)
<3>comment [#otherwise....] (14)
<3>comment [#granularity 5;] (15)
<3>comment [#syntax : phyint <interface> <disable> <metric> [metric] <preference> [preference]] (82)
<3>comment [#metric and pref are for the asserts messages] (45)
<3>comment [#samples :] (10)
<3>begin phyint [phyint] (6)
<7>lo
<9>disable
<9>end phyint [;] (1)
<3>begin phyint [phyint] (6)
<7>ppp0
<9>disable
<9>end phyint [;] (1)
<3>begin phyint [phyint] (6)
<7>enp1s0
<9>disable
<9>end phyint [;] (1)
<3>begin phyint [phyint] (6)
<7>enp2s0
<9>disable
<9>end phyint [;] (1)
<3>begin phyint [phyint] (6)
<7>enp3s0
<9>disable
<9>end phyint [;] (1)
<3>begin phyint [phyint] (6)
<7>br
-<9>lan
../pim6sd.conf 18: syntax error
../pim6sd.conf 18: fatal parse failure: exiting (1 errors)

from pim6sd.

troglobit avatar troglobit commented on July 19, 2024

Yup, that was it. Also turns out the tokenizer looked for the 'string' regexp as follow-up token to phyint rather than the 'ifname' regexp, that's why any changes to that regexp didn't bite.

Note: it seems the .conf file parser currently requires a ';' to end a statement. I'll look into making that optional later.

from pim6sd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.