If we have to 'ipfw fwd'-tag a packet the second time in ipfw_pfil_out() don't

prepend an already existing tag again.  Instead unlink it and prepend it again
to have it as the first tag in the chain.

PR:		kern/71380
This commit is contained in:
andre 2004-09-13 19:20:14 +00:00
parent e41803bc80
commit 2c213c186f

View File

@ -218,11 +218,13 @@ ipfw_check_out(void *arg, struct mbuf **m0, struct ifnet *ifp, int dir)
if (ipfw == 0 && args.next_hop != NULL) {
/* Overwrite existing tag. */
fwd_tag = m_tag_find(*m0, PACKET_TAG_IPFORWARD, NULL);
if (fwd_tag == NULL)
if (fwd_tag == NULL) {
fwd_tag = m_tag_get(PACKET_TAG_IPFORWARD,
sizeof(struct sockaddr_in), M_NOWAIT);
if (fwd_tag == NULL)
goto drop;
if (fwd_tag == NULL)
goto drop;
} else
m_tag_unlink(*m0, fwd_tag);
bcopy(args.next_hop, (fwd_tag+1), sizeof(struct sockaddr_in));
m_tag_prepend(*m0, fwd_tag);