git: net/ip_mroute: Fix 'struct igmpmsg' for x86_64

Aaron LI aly at crater.dragonflybsd.org
Fri Dec 25 07:38:28 PST 2020


commit bfb67b1bd1a4401995b5b7b592ef8628019b9113
Author: Uglymotha <uglymotha at wizdom.nu>
Date:   Thu Dec 24 17:28:58 2020 +0100

    net/ip_mroute: Fix 'struct igmpmsg' for x86_64
    
    The `struct igmpmsg` currently uses `u_long` to define the unused fields
    instead of `uint32_t`.  This breaks the mroute API on 64 bit systems,
    because `u_long` is 64bit there.  The following code in `ip_mroute.c`
    happily corrupts kernel upcall messages on 64bit systems as the fields
    are incorrectly shifted 8bytes to the right, overwriting the destination
    ip address in the packet.
    
    ```
    /*
     * Send message to routing daemon to install
     * a route into the kernel table
     */
    im = mtod(mm, struct igmpmsg *);
    im->im_msgtype = IGMPMSG_NOCACHE;
    im->im_mbz = 0;
    im->im_vif = vifi;
    ```
    
    Fix this issue by replacing `u_long` with `uint32_t` in `struct igmpmsg`.
    This change has also been made in FreeBSD at:
    https://github.com/freebsd/freebsd/commit/3dd767ffd091fb1e586741a1aedfcd67884312a4
    
    This fix is submitted by Uglymotha at GitHub:
    https://github.com/DragonFlyBSD/DragonFlyBSD/pull/11

Summary of changes:
 sys/net/ip_mroute/ip_mroute.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/bfb67b1bd1a4401995b5b7b592ef8628019b9113


-- 
DragonFly BSD source repository


More information about the Commits mailing list