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
Unknown Object (File)
Thu, Jan 30, 6:13 AM
Unknown Object (File)
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
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 Passed
Unit
No Test Coverage
Build Status
Buildable 58702
Build 55590: arc lint + arc unit

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
437

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.

444

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

usr.sbin/uhsoctl/uhsoctl.c
374

bzero?

381

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
374

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

381

Same as above.

437

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

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

444

I removed the mask argument.

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

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