When sending a packet from dummynet, indicate that we're forwarding

it so that ip_id etc. don't get overwritten.  This fixes forwarding
of fragmented IP packets through a dummynet pipe -- fragments came
out with modified and different(!) ip_id's, making it impossible to
reassemble a datagram at the receiver side.

Submitted by:	Alexander Karptsov (reworked by me)
MFC after:	3 days
This commit is contained in:
Ruslan Ermilov 2006-02-14 06:36:39 +00:00
parent 10a84fd9f7
commit ea9dce1461
3 changed files with 2 additions and 8 deletions

View File

@ -769,7 +769,7 @@ dummynet_send(struct mbuf *m)
pkt = dn_tag_get(m);
switch (pkt->dn_dir) {
case DN_TO_IP_OUT:
ip_output(m, NULL, NULL, pkt->flags, NULL, NULL);
ip_output(m, NULL, NULL, IP_FORWARDING, NULL, NULL);
break ;
case DN_TO_IP_IN :
ip = mtod(m, struct ip *);
@ -783,7 +783,7 @@ dummynet_send(struct mbuf *m)
break;
case DN_TO_IP6_OUT:
ip6_output(m, NULL, NULL, pkt->flags, NULL, NULL, NULL);
ip6_output(m, NULL, NULL, IPV6_FORWARDING, NULL, NULL, NULL);
break;
#endif
case DN_TO_IFB_FWD:
@ -1129,7 +1129,6 @@ locate_pipe(int pipe_nr)
* ifp the 'ifp' parameter from the caller.
* NULL in ip_input, destination interface in ip_output,
* rule matching rule, in case of multiple passes
* flags flags from the caller, only used in ip_output
*
*/
static int
@ -1213,8 +1212,6 @@ dummynet_io(struct mbuf *m, int dir, struct ip_fw_args *fwa)
pkt->dn_dir = dir ;
pkt->ifp = fwa->oif;
if (dir == DN_TO_IP_OUT || dir == DN_TO_IP6_OUT)
pkt->flags = fwa->flags;
if (q->head == NULL)
q->head = m;

View File

@ -130,7 +130,6 @@ struct dn_pkt_tag {
dn_key output_time; /* when the pkt is due for delivery */
struct ifnet *ifp; /* interface, for ip_output */
int flags ; /* flags, for ip_output (IPv6 ?) */
struct _ip6dn_args ip6opt; /* XXX ipv6 options */
};
#endif /* _KERNEL */

View File

@ -510,8 +510,6 @@ struct ip_fw_args {
struct ip_fw *rule; /* matching rule */
struct ether_header *eh; /* for bridged packets */
int flags; /* for dummynet */
struct ipfw_flow_id f_id; /* grabbed from IP header */
u_int32_t cookie; /* a cookie depending on rule action */
struct inpcb *inp;