Page MenuHomeFreeBSD

D12506.diff
No OneTemporary

D12506.diff

Index: head/sys/netpfil/ipfw/dn_sched_fifo.c
===================================================================
--- head/sys/netpfil/ipfw/dn_sched_fifo.c
+++ head/sys/netpfil/ipfw/dn_sched_fifo.c
@@ -33,13 +33,16 @@
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/mbuf.h>
#include <sys/module.h>
+#include <sys/rwlock.h>
#include <net/if.h> /* IFNAMSIZ */
#include <netinet/in.h>
#include <netinet/ip_var.h> /* ipfw_rule_ref */
#include <netinet/ip_fw.h> /* flow_id */
#include <netinet/ip_dummynet.h>
+#include <netpfil/ipfw/ip_fw_private.h>
#include <netpfil/ipfw/dn_heap.h>
#include <netpfil/ipfw/ip_dn_private.h>
#ifdef NEW_AQM
Index: head/sys/netpfil/ipfw/dn_sched_fq_codel.c
===================================================================
--- head/sys/netpfil/ipfw/dn_sched_fq_codel.c
+++ head/sys/netpfil/ipfw/dn_sched_fq_codel.c
@@ -218,13 +218,14 @@
uint8_t tuple[41];
uint16_t hash=0;
+ ip = (struct ip *)mtodo(m, dn_tag_get(m)->iphdr_off);
//#ifdef INET6
struct ip6_hdr *ip6;
int isip6;
- isip6 = (mtod(m, struct ip *)->ip_v == 6) ? 1 : 0;
+ isip6 = (ip->ip_v == 6);
if(isip6) {
- ip6 = mtod(m, struct ip6_hdr *);
+ ip6 = (struct ip6_hdr *)ip;
*((uint8_t *) &tuple[0]) = ip6->ip6_nxt;
*((uint32_t *) &tuple[1]) = si->perturbation;
memcpy(&tuple[5], ip6->ip6_src.s6_addr, 16);
@@ -253,7 +254,6 @@
//#endif
/* IPv4 */
- ip = mtod(m, struct ip *);
*((uint8_t *) &tuple[0]) = ip->ip_p;
*((uint32_t *) &tuple[1]) = si->perturbation;
*((uint32_t *) &tuple[5]) = ip->ip_src.s_addr;
Index: head/sys/netpfil/ipfw/dn_sched_fq_pie.c
===================================================================
--- head/sys/netpfil/ipfw/dn_sched_fq_pie.c
+++ head/sys/netpfil/ipfw/dn_sched_fq_pie.c
@@ -792,13 +792,14 @@
uint8_t tuple[41];
uint16_t hash=0;
+ ip = (struct ip *)mtodo(m, dn_tag_get(m)->iphdr_off);
//#ifdef INET6
struct ip6_hdr *ip6;
int isip6;
- isip6 = (mtod(m, struct ip *)->ip_v == 6) ? 1 : 0;
+ isip6 = (ip->ip_v == 6);
if(isip6) {
- ip6 = mtod(m, struct ip6_hdr *);
+ ip6 = (struct ip6_hdr *)ip;
*((uint8_t *) &tuple[0]) = ip6->ip6_nxt;
*((uint32_t *) &tuple[1]) = si->perturbation;
memcpy(&tuple[5], ip6->ip6_src.s6_addr, 16);
@@ -826,7 +827,6 @@
//#endif
/* IPv4 */
- ip = mtod(m, struct ip *);
*((uint8_t *) &tuple[0]) = ip->ip_p;
*((uint32_t *) &tuple[1]) = si->perturbation;
*((uint32_t *) &tuple[5]) = ip->ip_src.s_addr;
Index: head/sys/netpfil/ipfw/dn_sched_prio.c
===================================================================
--- head/sys/netpfil/ipfw/dn_sched_prio.c
+++ head/sys/netpfil/ipfw/dn_sched_prio.c
@@ -32,13 +32,16 @@
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/mbuf.h>
#include <sys/module.h>
+#include <sys/rwlock.h>
#include <net/if.h> /* IFNAMSIZ */
#include <netinet/in.h>
#include <netinet/ip_var.h> /* ipfw_rule_ref */
#include <netinet/ip_fw.h> /* flow_id */
#include <netinet/ip_dummynet.h>
+#include <netpfil/ipfw/ip_fw_private.h>
#include <netpfil/ipfw/dn_heap.h>
#include <netpfil/ipfw/ip_dn_private.h>
#ifdef NEW_AQM
Index: head/sys/netpfil/ipfw/dn_sched_qfq.c
===================================================================
--- head/sys/netpfil/ipfw/dn_sched_qfq.c
+++ head/sys/netpfil/ipfw/dn_sched_qfq.c
@@ -33,13 +33,16 @@
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/mbuf.h>
#include <sys/module.h>
+#include <sys/rwlock.h>
#include <net/if.h> /* IFNAMSIZ */
#include <netinet/in.h>
#include <netinet/ip_var.h> /* ipfw_rule_ref */
#include <netinet/ip_fw.h> /* flow_id */
#include <netinet/ip_dummynet.h>
+#include <netpfil/ipfw/ip_fw_private.h>
#include <netpfil/ipfw/dn_heap.h>
#include <netpfil/ipfw/ip_dn_private.h>
#ifdef NEW_AQM
Index: head/sys/netpfil/ipfw/dn_sched_rr.c
===================================================================
--- head/sys/netpfil/ipfw/dn_sched_rr.c
+++ head/sys/netpfil/ipfw/dn_sched_rr.c
@@ -33,13 +33,16 @@
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/mbuf.h>
#include <sys/module.h>
+#include <sys/rwlock.h>
#include <net/if.h> /* IFNAMSIZ */
#include <netinet/in.h>
#include <netinet/ip_var.h> /* ipfw_rule_ref */
#include <netinet/ip_fw.h> /* flow_id */
#include <netinet/ip_dummynet.h>
+#include <netpfil/ipfw/ip_fw_private.h>
#include <netpfil/ipfw/dn_heap.h>
#include <netpfil/ipfw/ip_dn_private.h>
#ifdef NEW_AQM
Index: head/sys/netpfil/ipfw/dn_sched_wf2q.c
===================================================================
--- head/sys/netpfil/ipfw/dn_sched_wf2q.c
+++ head/sys/netpfil/ipfw/dn_sched_wf2q.c
@@ -34,13 +34,16 @@
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/mbuf.h>
#include <sys/module.h>
+#include <sys/rwlock.h>
#include <net/if.h> /* IFNAMSIZ */
#include <netinet/in.h>
#include <netinet/ip_var.h> /* ipfw_rule_ref */
#include <netinet/ip_fw.h> /* flow_id */
#include <netinet/ip_dummynet.h>
+#include <netpfil/ipfw/ip_fw_private.h>
#include <netpfil/ipfw/dn_heap.h>
#include <netpfil/ipfw/ip_dn_private.h>
#ifdef NEW_AQM
Index: head/sys/netpfil/ipfw/ip_dn_io.c
===================================================================
--- head/sys/netpfil/ipfw/ip_dn_io.c
+++ head/sys/netpfil/ipfw/ip_dn_io.c
@@ -237,27 +237,10 @@
static void dummynet_send(struct mbuf *);
/*
- * Packets processed by dummynet have an mbuf tag associated with
- * them that carries their dummynet state.
- * Outside dummynet, only the 'rule' field is relevant, and it must
- * be at the beginning of the structure.
- */
-struct dn_pkt_tag {
- struct ipfw_rule_ref rule; /* matching rule */
-
- /* second part, dummynet specific */
- int dn_dir; /* action when packet comes out.*/
- /* see ip_fw_private.h */
- uint64_t output_time; /* when the pkt is due for delivery*/
- struct ifnet *ifp; /* interface, for ip_output */
- struct _ip6dn_args ip6opt; /* XXX ipv6 options */
-};
-
-/*
* Return the mbuf tag holding the dummynet state (it should
* be the first one on the list).
*/
-static struct dn_pkt_tag *
+struct dn_pkt_tag *
dn_tag_get(struct mbuf *m)
{
struct m_tag *mtag = m_tag_first(m);
@@ -448,7 +431,7 @@
ecn_mark(struct mbuf* m)
{
struct ip *ip;
- ip = mtod(m, struct ip *);
+ ip = (struct ip *)mtodo(m, dn_tag_get(m)->iphdr_off);
switch (ip->ip_v) {
case IPVERSION:
@@ -472,7 +455,7 @@
#ifdef INET6
case (IPV6_VERSION >> 4):
{
- struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
+ struct ip6_hdr *ip6 = (struct ip6_hdr *)ip;
u_int32_t flowlabel;
flowlabel = ntohl(ip6->ip6_flow);
@@ -859,6 +842,7 @@
dt->ifp = fwa->oif;
/* dt->output tame is updated as we move through */
dt->output_time = dn_cfg.curr_time;
+ dt->iphdr_off = (dir & PROTO_LAYER2) ? ETHER_HDR_LEN : 0;
return 0;
}
Index: head/sys/netpfil/ipfw/ip_dn_private.h
===================================================================
--- head/sys/netpfil/ipfw/ip_dn_private.h
+++ head/sys/netpfil/ipfw/ip_dn_private.h
@@ -367,6 +367,24 @@
DN_QHT_IS_Q = 0x0100, /* in flowset, qht is a single queue */
};
+/*
+ * Packets processed by dummynet have an mbuf tag associated with
+ * them that carries their dummynet state.
+ * Outside dummynet, only the 'rule' field is relevant, and it must
+ * be at the beginning of the structure.
+ */
+struct dn_pkt_tag {
+ struct ipfw_rule_ref rule; /* matching rule */
+
+ /* second part, dummynet specific */
+ int dn_dir; /* action when packet comes out.*/
+ /* see ip_fw_private.h */
+ uint64_t output_time; /* when the pkt is due for delivery*/
+ struct ifnet *ifp; /* interface, for ip_output */
+ struct _ip6dn_args ip6opt; /* XXX ipv6 options */
+ uint16_t iphdr_off; /* IP header offset for mtodo() */
+};
+
extern struct dn_parms dn_cfg;
//VNET_DECLARE(struct dn_parms, _base_dn_cfg);
//#define dn_cfg VNET(_base_dn_cfg)
@@ -374,6 +392,7 @@
int dummynet_io(struct mbuf **, int , struct ip_fw_args *);
void dummynet_task(void *context, int pending);
void dn_reschedule(void);
+struct dn_pkt_tag * dn_tag_get(struct mbuf *m);
struct dn_queue *ipdn_q_find(struct dn_fsk *, struct dn_sch_inst *,
struct ipfw_flow_id *);

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 10, 12:13 AM (9 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31180942
Default Alt Text
D12506.diff (8 KB)

Event Timeline