Page MenuHomeFreeBSD

ifconfig: fix endianness bug displaying pfsync interfaces
ClosedPublic

Authored by asomers on Jan 28 2019, 4:48 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 20, 3:22 AM
Unknown Object (File)
Tue, Apr 9, 5:56 AM
Unknown Object (File)
Mon, Apr 8, 3:31 PM
Unknown Object (File)
Mon, Mar 25, 10:07 PM
Unknown Object (File)
Feb 24 2024, 8:55 AM
Unknown Object (File)
Jan 11 2024, 10:54 PM
Unknown Object (File)
Jan 4 2024, 3:11 AM
Unknown Object (File)
Dec 20 2023, 12:29 AM
Subscribers

Details

Summary

ifconfig: fix endianness bug displaying pfsync interfaces

Test Plan

ifconfig tun0 create
kldload pfsync
ifconfig pfsync syncdev tun0
ifconfig pfsync0 # Verify that peer address doesn't display

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 22216
Build 21425: arc lint + arc unit

Event Timeline

kp added inline comments.
sbin/ifconfig/ifpfsync.c
198

I think that needs to be 'htonl()'.

It'll work of course, but INADDR_PFSYNC_GROUP is in host byte order, and preq.pfsyncr_syncpeer.s_addr is in network order, so you want to go from host to network order, and not the other way around.

sbin/ifconfig/ifpfsync.c
198

Oh, my mistake. I saw the definition and read it as a byte array, ignoring the leading (in_addr_t)

#define INADDR_PFSYNC_GROUP     ((in_addr_t)0xe00000f0) /* 224.0.0.240 */
This revision is now accepted and ready to land.Jan 28 2019, 5:44 PM
This revision was automatically updated to reflect the committed changes.