diff --git a/sys/contrib/ipfilter/netinet/fil.c b/sys/contrib/ipfilter/netinet/fil.c index bf53525d6141..50f81308e458 100644 --- a/sys/contrib/ipfilter/netinet/fil.c +++ b/sys/contrib/ipfilter/netinet/fil.c @@ -4436,8 +4436,8 @@ ipf_rule_compare(frentry_t *fr1, frentry_t *fr2) return (2); if (fr1->fr_dsize != fr2->fr_dsize) return (3); - if (bcmp((char *)&fr1->fr_func, (char *)&fr2->fr_func, - fr1->fr_size - offsetof(struct frentry, fr_func)) != 0) + if (bcmp((char *)&fr1->fr_func, (char *)&fr2->fr_func, FR_CMPSIZ(fr1)) + != 0) return (4); if (fr1->fr_data && !fr2->fr_data) return (5); diff --git a/sys/contrib/ipfilter/netinet/ip_fil.h b/sys/contrib/ipfilter/netinet/ip_fil.h index 4b3beb8cc60b..f4ffa53391ce 100644 --- a/sys/contrib/ipfilter/netinet/ip_fil.h +++ b/sys/contrib/ipfilter/netinet/ip_fil.h @@ -827,7 +827,7 @@ typedef struct frentry { #define FR_NOLOGTAG 0 -#define FR_CMPSIZ (sizeof(struct frentry) - \ +#define FR_CMPSIZ(_f) ((_f)->fr_size - \ offsetof(struct frentry, fr_func)) #define FR_NAME(_f, _n) (_f)->fr_names + (_f)->_n