git: ipfw3: Fix offset mistake in creating the MAC-type table

Aaron LI aly at crater.dragonflybsd.org
Mon Nov 13 17:46:25 PST 2023


commit 751adc91d200b6199c8e871a12c98e8af4482417
Author: Aaron LI <aly at aaronly.me>
Date:   Tue Nov 14 08:36:32 2023 +0800

    ipfw3: Fix offset mistake in creating the MAC-type table
    
    The rn_inithead() requires the offset be the bit count of the address
    portion from the key beginning, so it should be
    offsetof(struct sockaddr, sa_data) * NBBY = 2 * 8 = 16 (instead of 48)
    for the MAC-type table.
    
    Also change to use offsetof() to replace the hardcode 32 in creating the
    IP-type table.  In addition, improve the assignments of sin_len/sa_len
    members of the keys.
    
    While there, fix the indentation style.

Summary of changes:
 sys/net/ipfw3_basic/ip_fw3_table.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/751adc91d200b6199c8e871a12c98e8af4482417


-- 
DragonFly BSD source repository


More information about the Commits mailing list