Due to a memory alignment sizeof(struct ipfw_flow_id) is bigger than

ipfw_flow_id structure actual size and bcmp(3) may fail to compare
them properly. Compare members of these structures instead.

PR:		kern/44078
Submitted by:	Oleg Bulyzhin <oleg@rinet.ru>
Reviewed by:	luigi
MFC after:	2 weeks
This commit is contained in:
maxim 2002-11-13 11:31:44 +00:00
parent 69fdcfb883
commit 809d226228

View File

@ -879,7 +879,12 @@ find_queue(struct dn_flow_set *fs, struct ipfw_flow_id *id)
searches++ ;
for (prev=NULL, q = fs->rq[i] ; q ; ) {
search_steps++;
if (bcmp(id, &(q->id), sizeof(q->id) ) == 0)
if (id->dst_ip == q->id.dst_ip &&
id->src_ip == q->id.src_ip &&
id->dst_port == q->id.dst_port &&
id->src_port == q->id.src_port &&
id->proto == q->id.proto &&
id->flags == q->id.flags)
break ; /* found */
else if (pipe_expire && q->head == NULL && q->S == q->F+1 ) {
/* entry is idle and not in any heap, expire it */