Sebastien Roy wrote: > Cathy Zhou wrote: >> I can think two solutions: >> >> a. using strcmp(), and only allow fallback for certain drivers, >> including ib and vni. >> >> b. only fallback when opening /dev/net/<ifN> returns ENOENT. >> >> I think b would solve the problem in this scenario but it might not >> cover all cases. >> >> What do you think? > > I also think b is appropriate. I think that all errors other than > ENOENT point towards a problem with the attempted access of an existing > /dev/net node which the calling process needs to know about. Either > EPERM, EEXIST, or whatever. We'd only want to fall back if the node in > /dev/net doesn't exist.
Joanna helps me to find a case that the "fallback-after-ENOENT" logic cannot solve: assume a system with a bge0 device, and one renamed it to become net0, then opening bge0 or bge1000 should fail. But because opening /dev/net/bge0 or /dev/net/bge1000 returns ENOENT, it falls back to open the one in /dev, and it succeeds. It seems that we have to use strcmp() unless someone have better idea. Thanks - Cathy
