Recycle the unused FR_CMPSIZ macro which became orphaned in ipfilter 5

prior to its import into FreeBSD. This macro calculates the size to be
compared within the frentry structure. The ipfilter 4 version of the
macro calculated the compare size based upon the static size of the
frentry struct. Today it uses the ipfilter 5 method of calculating the
size based upon the new to ipfilter 5 fr_size value found in the
frentry struct itself.

No effective change in code is intended.

MFC after:	1 week
This commit is contained in:
Cy Schubert 2019-07-14 02:46:30 +00:00
parent d4af744b6a
commit 49a28fbdd2
2 changed files with 3 additions and 3 deletions

View File

@ -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);

View File

@ -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