tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

re: COMPAT_50 vs NET_RT_IFLIST



> I still cannot explain how things got broken between 5.2 and 8.0.  I
> will defer to those who are more expert in this area than am I.  My
> suspicion is that the breakage is related to sys/socket.h rev 1.99
> which versioned AF_{,O}ROUTE for some 64-bit cleanliness.

i think i have a guess about the problem.

sys/net/if.h, sys/net/route.h, and sys/compat/net/if.h all
have this code:

/*
 * Message format for use in obtaining information about interfaces from
 * sysctl and the routing socket.  We need to force 64-bit alignment if we
 * aren't using compatiblity definitons.
 */
#if !defined(_KERNEL) || !defined(COMPAT_RTSOCK)
#define __align64       __aligned(sizeof(uint64_t))
#else
#define __align64
#endif
struct if_msghdr {
        u_short ifm_msglen __align64;

but i think this comment is wrong.

the compat structures are defined in the compat headers and
the above structure should never change, however when the
code handling code wants to talk to the *real* structure it
will get this adjusted one (without the align), and thus
it will copy the wrong portions out from it.

the fix may be as simple as removing this from these headers
(leaving it always defined for the current defs), and making
sure that the compat headers have the right alignment (my
quick look seem ok.)

this will, obviously, need a recompile of the newer kernel.


.mrg.


Home | Main Index | Thread Index | Old Index