From ea9dce1461b5589a7ba183ae0c8f6e5e55bc6358 Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Tue, 14 Feb 2006 06:36:39 +0000 Subject: [PATCH] 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 --- sys/netinet/ip_dummynet.c | 7 ++----- sys/netinet/ip_dummynet.h | 1 - sys/netinet/ip_fw.h | 2 -- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/sys/netinet/ip_dummynet.c b/sys/netinet/ip_dummynet.c index 4390cfedd5d8..4c02915f38ed 100644 --- a/sys/netinet/ip_dummynet.c +++ b/sys/netinet/ip_dummynet.c @@ -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; diff --git a/sys/netinet/ip_dummynet.h b/sys/netinet/ip_dummynet.h index 9749c08348fc..de12c65aaecc 100644 --- a/sys/netinet/ip_dummynet.h +++ b/sys/netinet/ip_dummynet.h @@ -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 */ diff --git a/sys/netinet/ip_fw.h b/sys/netinet/ip_fw.h index e6ab185310a2..05d8b7dd2628 100644 --- a/sys/netinet/ip_fw.h +++ b/sys/netinet/ip_fw.h @@ -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;