Page MenuHomeFreeBSD

usr.sbin/uhsoctl: correct SIOCDIFADDR calls to use ifreq
ClosedPublic

Authored by def on Jul 18 2024, 3:02 PM.
Tags
None
Referenced Files
F108855271: D46019.diff
Tue, Jan 28, 6:13 PM
Unknown Object (File)
Dec 29 2024, 8:44 AM
Unknown Object (File)
Oct 30 2024, 12:30 AM
Unknown Object (File)
Oct 18 2024, 4:53 AM
Unknown Object (File)
Oct 1 2024, 1:49 PM
Unknown Object (File)
Oct 1 2024, 7:53 AM
Unknown Object (File)
Sep 21 2024, 2:29 AM
Unknown Object (File)
Sep 17 2024, 7:57 PM
Subscribers

Details

Summary

The SIOCDIFADDR ioctl takes an ifreq structure object, not an ifaliasreq
structure object, as its argument.

Obtained from: CheriBSD

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

def requested review of this revision.Jul 18 2024, 3:02 PM

@brooks @oshogbo Do you have any suggestions who should review this? It is not clear to me based on the commit history.

FWIW, this program and the associated driver are pretty old and with 3g being phased out fairly rapidly in much of the world it should probably be removed soon.

The only real mention I found was https://dmesgd.nycbug.org/index.cgi?do=view&id=4517 and that appears to be a 2008/2009 vintage laptop.

This revision is now accepted and ready to land.Jul 18 2024, 7:56 PM
jhb added inline comments.
usr.sbin/uhsoctl/uhsoctl.c
412

Given that there's no longer a lot of shared code here, I would just remove ifaddr_ad entirely and push the logic down into these two functions directly instead.

421

Ideally we'd remove the mask argument from here as well.

usr.sbin/uhsoctl/uhsoctl.c
360

bzero?

367

ditto.

Remove ifaddr_ad() and move its logic to callers.

This revision now requires review to proceed.Jul 22 2024, 12:26 PM
usr.sbin/uhsoctl/uhsoctl.c
360

Isn't bzero() deprecated? Also, uhsoctl already uses memset(..., 0, ...) so I guess it's better to be consistent here.

367

Same as above.

412

I removed ifaddr_ad() and moved its logic to callers.

I updated the commit message to explain that SIOCDIFADDR does not use a netmask.

421

I removed the mask argument.

jhb added inline comments.
usr.sbin/uhsoctl/uhsoctl.c
360

Yes, memset() (POSIX) is preferred over bzero() (BSD-only) at this point.

This revision is now accepted and ready to land.Jul 22 2024, 2:05 PM