Free the dummynet descriptor in ip_dummynet, not in the called
routines. The descriptor contains parameters which could be used within those routines (eg. ip_output() ). On passing, add IPPROTO_PGM entry to netinet/in.h
This commit is contained in:
parent
5e4b06fbd3
commit
eaa726bed6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=46420
@ -508,9 +508,7 @@ bdg_forward (struct mbuf **m0, struct ifnet *dst)
|
||||
* processing was already done, and we need to go down.
|
||||
*/
|
||||
rule = (struct ip_fw_chain *)(m->m_data) ;
|
||||
(*m0) = m->m_next ;
|
||||
FREE(m, M_IPFW);
|
||||
m = *m0 ;
|
||||
(*m0) = m = m->m_next ;
|
||||
|
||||
src = m->m_pkthdr.rcvif; /* could be NULL in output */
|
||||
eh = mtod(m, struct ether_header *); /* XXX */
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)in.h 8.3 (Berkeley) 1/3/94
|
||||
* $Id: in.h,v 1.39 1999/04/20 13:32:04 peter Exp $
|
||||
* $Id: in.h,v 1.40 1999/04/28 11:37:43 phk Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NETINET_IN_H_
|
||||
@ -140,7 +140,8 @@
|
||||
#define IPPROTO_ENCAP 98 /* encapsulation header */
|
||||
#define IPPROTO_APES 99 /* any private encr. scheme */
|
||||
#define IPPROTO_GMTP 100 /* GMTP*/
|
||||
/* 101-254: Unassigned */
|
||||
/* 101-254: Partly Unassigned */
|
||||
#define IPPROTO_PGM 113 /* PGM */
|
||||
/* 255: Reserved */
|
||||
/* BSD Private, local use, namespace incursion */
|
||||
#define IPPROTO_DIVERT 254 /* divert pseudo-protocol */
|
||||
|
@ -10,7 +10,7 @@
|
||||
*
|
||||
* This software is provided ``AS IS'' without any warranties of any kind.
|
||||
*
|
||||
* $Id: ip_dummynet.c,v 1.12 1999/04/20 13:32:04 peter Exp $
|
||||
* $Id: ip_dummynet.c,v 1.13 1999/05/04 07:30:07 luigi Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -211,8 +211,9 @@ dn_move(struct dn_pipe *pipe, int immediate)
|
||||
* m_next = the actual mbuf to be processed by ip_input/output
|
||||
* m_data = the matching rule
|
||||
* The vestigial element is the same memory area used by
|
||||
* the dn_pkt, and IS FREED IN ip_input/ip_output. IT IS
|
||||
* NOT A REAL MBUF, just a block of memory acquired with malloc().
|
||||
* the dn_pkt, and IS FREED HERE because it can contain
|
||||
* parameters passed to the called routine. The buffer IS NOT
|
||||
* A REAL MBUF, just a block of memory acquired with malloc().
|
||||
*/
|
||||
switch (pkt->dn_dir) {
|
||||
case DN_TO_IP_OUT: {
|
||||
@ -239,9 +240,9 @@ dn_move(struct dn_pipe *pipe, int immediate)
|
||||
default:
|
||||
printf("dummynet: bad switch %d!\n", pkt->dn_dir);
|
||||
m_freem(pkt->dn_m);
|
||||
FREE(pkt, M_IPFW);
|
||||
break ;
|
||||
}
|
||||
FREE(pkt, M_IPFW);
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ip_input.c 8.2 (Berkeley) 1/4/94
|
||||
* $Id: ip_input.c,v 1.117 1999/04/20 13:32:05 peter Exp $
|
||||
* $Id: ip_input.c,v 1.118 1999/05/03 23:57:29 billf Exp $
|
||||
*/
|
||||
|
||||
#define _IP_VHL
|
||||
@ -256,10 +256,8 @@ ip_input(struct mbuf *m)
|
||||
* rule.
|
||||
*/
|
||||
if (m->m_type == MT_DUMMYNET) {
|
||||
struct mbuf *m0 = m ;
|
||||
rule = (struct ip_fw_chain *)(m->m_data) ;
|
||||
m = m->m_next ;
|
||||
free(m0, M_IPFW);
|
||||
ip = mtod(m, struct ip *);
|
||||
hlen = IP_VHL_HL(ip->ip_vhl) << 2;
|
||||
goto iphack ;
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ip_output.c 8.3 (Berkeley) 1/21/94
|
||||
* $Id: ip_output.c,v 1.88 1999/04/20 13:32:06 peter Exp $
|
||||
* $Id: ip_output.c,v 1.89 1999/05/04 09:26:12 luigi Exp $
|
||||
*/
|
||||
|
||||
#define _IP_VHL
|
||||
@ -139,7 +139,6 @@ ip_output(m0, opt, ro, flags, imo)
|
||||
* rule.
|
||||
*/
|
||||
if (m->m_type == MT_DUMMYNET) {
|
||||
struct mbuf *tmp_m = m ;
|
||||
/*
|
||||
* the packet was already tagged, so part of the
|
||||
* processing was already done, and we need to go down.
|
||||
@ -148,7 +147,6 @@ ip_output(m0, opt, ro, flags, imo)
|
||||
*/
|
||||
rule = (struct ip_fw_chain *)(m->m_data) ;
|
||||
m0 = m = m->m_next ;
|
||||
free(tmp_m, M_IPFW);
|
||||
ip = mtod(m, struct ip *);
|
||||
dst = (struct sockaddr_in *)flags ;
|
||||
ifp = (struct ifnet *)opt;
|
||||
|
Loading…
Reference in New Issue
Block a user