Avoid undefined behavior.

The 'pktid' variable is modified while being used twice between
sequence points, probably due to htonl() is macro.

Reported by:	PVS-Studio
MFC after:	1 week
This commit is contained in:
Andrey V. Elsukov 2017-04-14 11:58:41 +00:00
parent ba3e1361b0
commit da62ffd9cd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=316826

View File

@ -75,7 +75,8 @@ nat64stl_log(struct pfloghdr *plog, struct mbuf *m, sa_family_t family,
plog->action = PF_NAT;
plog->dir = PF_IN;
plog->rulenr = htonl(kidx);
plog->subrulenr = htonl(++pktid);
pktid++;
plog->subrulenr = htonl(pktid);
plog->ruleset[0] = '\0';
strlcpy(plog->ifname, "NAT64STL", sizeof(plog->ifname));
ipfw_bpf_mtap2(plog, PFLOG_HDRLEN, m);