yellowman / nsh

OpenBSD networking configuration shell
http://www.nmedia.net/nsh/
Other
175 stars 27 forks source link

put interfaces UP explicitly if setting an address does not suffice #51

Closed stspdotname closed 1 year ago

stspdotname commented 1 year ago

Needed for vport(4) interfaces which stay down by default.

yellowman commented 1 year ago

I don't have a problem with this, but i'm a little surprised. Is this a bug in veb? Perhaps some condition is not met for vport to be up when SIOCSIFADDR happens?

stspdotname commented 1 year ago

Leaving vport/veb down when an address is configured was a deliberate choice by dlg@.

smytht commented 1 year ago

Closing Pull Request suggested... by stefan

stspdotname commented 1 year ago

See https://marc.info/?l=openbsd-tech&m=163694170701450&w=2

stspdotname commented 1 year ago

I think this should be re-opened and merged. Without this vport cannot be used by nsh users without explicit use of 'no shutdown'.

smytht commented 1 year ago

Re Opened as requested by Stefan

yellowman commented 1 year ago

Ahh, here's dlg's reply:

"My counter argument is that no interface should implicitly bring itself up when an address is configured because it has been a road block to figuring out how to lock the ioctl paths better, and it confuses error handling. If address config works, but the interface fails to come up, the address remains configured but we report an error. But it looks like configuring an address failed? Wat."

I can't say he's wrong, I can only say that we need consistency.

yellowman commented 1 year ago

To finish my last post, doing this is more consistent than going along with vport's reset of the UP flag.

Since 'shutdown' state isn't consistent among all interfaces, nsh assumes that ports with an IP address set are already UP. vport breaks this assumption and nsh would not work consistently in its current state with vport. A 'no shutdown' will not be printed by nsh because it already has an IP address set.

Forcing UP is the best solution until dlg pushes through system-wide IFF_UP changes on SIOCSIFADDR, or until some other uniform policy is reached.