Question about conventions?

This one is interesting and would be worth examining in a broader context of how this should be done...

In this thread, I was able to correctly guess that the WAN interface was entered as uppercase before even seeing the configuration. My hunch was confirmed, and when the OP changed it to lowercase, it fixed the issue.

So, here we have a bunch of things going on.

  • First, the conventions page says that interfaces are typically in CAPS. However, the default LAN and WAN interfaces are actually in lowercase. I don't know the history behind both the convention and the default case for the standard interfaces, but they don't seem to align (don't know how to rectify this).
  • Next, LuCI displays these interfaces in all CAPS which obfuscates the true case of the interfaces as handled in the UCI / config syntax.
  • The firewall zones, by default, are all lowercase. So you have the 'lan' interface in the 'lan' zone -- this is fine for those who know what is going on, but it might be hard to understand for newcomers. For example, is it okay to have a 'LAN' interface in the 'lan' zone or vice versa, or a 'LAN' zone with 'LAN' interface (of course, the answer is yes, functionally it will work just fine as long as the case-sensitivity is self-consistent)
  • Interestingly, LuCI does display case properly for firewall zones.
  • And finally, since the interfaces and firewall zone are indeed case sensitive, it might be hard for LuCI based users to see that there is a problem such as an uppercase 'WAN' interface such as in the thread I linked above.

I'm don't really have any specific answers about how to handle all of this stuff, but I think it is important to make sure that users understand that case sensitivity is a thing in OpenWrt, that the conventions are a suggestion but not a mandate, and that sometimes the conventions don't line up with the default conditions of OpenWrt.

1 Like