Bug #3306
closedBug #3305: CBSD: Add NVMM support in DragonFly BSD
Add description support for ifconfig(8)
100%
Description
Is there a chance the 'ifconfig NIC description XXX' functionality
will sync with the FreeBSD ? This is a fairly popular option.
# ifconfig vlan1 description vm1-vlan ifconfig: description: bad value
OpenBSD also has a similar capability1, as NetBSD as well2
Thanks!
__
Files
Updated by tuxillo about 3 years ago
- File 01-if-descr.patch 01-if-descr.patch added
- Status changed from New to In Progress
- % Done changed from 0 to 50
Preliminary patch, can you please review it @dillon, @sepherosa?
Updated by dillon about 3 years ago
The ioctl code in the kernel needs to ensure that the buffer is zero-terminated, or it needs to zero-terminate the buffer itself, that it stores in if_description. Otherwise the strlen() on the read side will overrun the buffer if userland intentionally sets a description that is not zero-terminated.
-Matt
Updated by liweitianux about 3 years ago
- File 01-if-descr.aly.diff 01-if-descr.aly.diff added
Hi tuxillo. Thank you for the work.
I've reviewed the patch and tweaked it a bit. Attached is the new patch, and you can diff to see the difference.
The main change is to the description ioctl(SIOCGIFDESCR) and print part. According to the manpage and actual implementation, if the supplied buffer is too small, then ioctl(SIOCGIFDESCR) returns an error. It looks to me the code in ifconfig.c is having issues. I fixed it (but not yet tested).
Another minor issue is that I'm not sure returning ENOMSG is a good choice. This errno is seldomly used, and I think that case is just normal (no description set), so it's fine to just return 0.
Cheers,
Aaron
Updated by tuxillo over 2 years ago
- Status changed from In Progress to Closed
- % Done changed from 50 to 100
Applied in changeset dragonflybsd|f6994c54d4ef3b530f323130b6d2a46ec6805672.