Project

General

Profile

Actions

Bug #3306

open

Bug #3305: CBSD: Add NVMM support in DragonFly BSD

Add description support for ifconfig(8)

Added by tuxillo 16 days ago. Updated 13 days ago.

Status:
In Progress
Priority:
Normal
Assignee:
-
Category:
Userland
Target version:
Start date:
11/12/2021
Due date:
% Done:

50%

Estimated time:

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!
__

1 https://man.openbsd.org/ifconfig.8

2 https://man.netbsd.org/ifconfig.8


Files

01-if-descr.patch (11.7 KB) 01-if-descr.patch tuxillo, 11/12/2021 04:49 PM
01-if-descr.aly.diff (11.8 KB) 01-if-descr.aly.diff updated if description patch liweitianux, 11/15/2021 02:02 AM
Actions #1

Updated by tuxillo 16 days ago

Preliminary patch, can you please review it dillon, sepherosa?

Actions #2

Updated by dillon 16 days 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

Actions #3

Updated by liweitianux 13 days ago

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

Actions

Also available in: Atom PDF