summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2011-07-03 23:48:42 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2011-07-03 23:48:42 +0000
commit69c6e3e717bc952ed47f81420147377d3ee74a7d (patch)
tree731d423460210eca357eb2a87d73efb3dd88b26a /sys
parent69240bae0a387491fc1d8fb296824ff70efc4e84 (diff)
g/c code to read/write the dscp field. with pf as classifier altq has no
business in mucking with it and since the _CLEARDSCP flags were never possibly set that is effectively dead code
Diffstat (limited to 'sys')
-rw-r--r--sys/altq/altq_cbq.h3
-rw-r--r--sys/altq/altq_hfsc.c9
-rw-r--r--sys/altq/altq_hfsc.h3
-rw-r--r--sys/altq/altq_priq.c9
-rw-r--r--sys/altq/altq_priq.h3
-rw-r--r--sys/altq/altq_rmclass.c9
-rw-r--r--sys/altq/altq_rmclass.h3
-rw-r--r--sys/altq/altq_subr.c117
-rw-r--r--sys/altq/altq_var.h3
9 files changed, 9 insertions, 150 deletions
diff --git a/sys/altq/altq_cbq.h b/sys/altq/altq_cbq.h
index a4534c6da92..b78089db3f4 100644
--- a/sys/altq/altq_cbq.h
+++ b/sys/altq/altq_cbq.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: altq_cbq.h,v 1.11 2011/07/03 22:39:12 tedu Exp $ */
+/* $OpenBSD: altq_cbq.h,v 1.12 2011/07/03 23:48:41 henning Exp $ */
/* $KAME: altq_cbq.h,v 1.5 2000/12/02 13:44:40 kjc Exp $ */
/*
@@ -49,7 +49,6 @@ extern "C" {
#define CBQCLF_ECN 0x0002 /* use RED/ECN */
#define CBQCLF_RIO 0x0004 /* use RIO */
#define CBQCLF_FLOWVALVE 0x0008 /* use flowvalve (aka penalty-box) */
-#define CBQCLF_CLEARDSCP 0x0010 /* clear diffserv codepoint */
#define CBQCLF_BORROW 0x0020 /* borrow from parent */
/* class flags only for root class */
diff --git a/sys/altq/altq_hfsc.c b/sys/altq/altq_hfsc.c
index f3771af6e67..c0dd8339176 100644
--- a/sys/altq/altq_hfsc.c
+++ b/sys/altq/altq_hfsc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: altq_hfsc.c,v 1.26 2008/05/08 15:22:02 chl Exp $ */
+/* $OpenBSD: altq_hfsc.c,v 1.27 2011/07/03 23:48:41 henning Exp $ */
/* $KAME: altq_hfsc.c,v 1.17 2002/11/29 07:48:33 kjc Exp $ */
/*
@@ -369,10 +369,6 @@ hfsc_class_create(struct hfsc_if *hif, struct service_curve *rsc,
red_flags = 0;
if (flags & HFCF_ECN)
red_flags |= REDF_ECN;
-#ifdef ALTQ_RIO
- if (flags & HFCF_CLEARDSCP)
- red_flags |= RIOF_CLEARDSCP;
-#endif
if (m2 < 8)
red_pkttime = 1000 * 1000 * 1000; /* 1 sec */
else
@@ -755,9 +751,6 @@ hfsc_addq(struct hfsc_class *cl, struct mbuf *m)
return (-1);
}
- if (cl->cl_flags & HFCF_CLEARDSCP)
- write_dsfield(m, cl->cl_pktattr, 0);
-
_addq(cl->cl_q, m);
return (0);
diff --git a/sys/altq/altq_hfsc.h b/sys/altq/altq_hfsc.h
index 101980bf587..2bc06c1ee66 100644
--- a/sys/altq/altq_hfsc.h
+++ b/sys/altq/altq_hfsc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: altq_hfsc.h,v 1.7 2011/07/03 22:39:12 tedu Exp $ */
+/* $OpenBSD: altq_hfsc.h,v 1.8 2011/07/03 23:48:41 henning Exp $ */
/* $KAME: altq_hfsc.h,v 1.8 2002/11/29 04:36:23 kjc Exp $ */
/*
@@ -55,7 +55,6 @@ struct service_curve {
#define HFCF_RED 0x0001 /* use RED */
#define HFCF_ECN 0x0002 /* use RED/ECN */
#define HFCF_RIO 0x0004 /* use RIO */
-#define HFCF_CLEARDSCP 0x0010 /* clear diffserv codepoint */
#define HFCF_DEFAULTCLASS 0x1000 /* default class */
/* service curve types */
diff --git a/sys/altq/altq_priq.c b/sys/altq/altq_priq.c
index b6628c627f6..437e8d6d9cf 100644
--- a/sys/altq/altq_priq.c
+++ b/sys/altq/altq_priq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: altq_priq.c,v 1.22 2008/05/08 15:22:02 chl Exp $ */
+/* $OpenBSD: altq_priq.c,v 1.23 2011/07/03 23:48:41 henning Exp $ */
/* $KAME: altq_priq.c,v 1.1 2000/10/18 09:15:23 kjc Exp $ */
/*
* Copyright (C) 2000
@@ -291,10 +291,6 @@ priq_class_create(struct priq_if *pif, int pri, int qlimit, int flags, int qid)
red_flags = 0;
if (flags & PRCF_ECN)
red_flags |= REDF_ECN;
-#ifdef ALTQ_RIO
- if (flags & PRCF_CLEARDSCP)
- red_flags |= RIOF_CLEARDSCP;
-#endif
if (pif->pif_bandwidth < 8)
red_pkttime = 1000 * 1000 * 1000; /* 1 sec */
else
@@ -457,9 +453,6 @@ priq_addq(struct priq_class *cl, struct mbuf *m)
return (-1);
}
- if (cl->cl_flags & PRCF_CLEARDSCP)
- write_dsfield(m, cl->cl_pktattr, 0);
-
_addq(cl->cl_q, m);
return (0);
diff --git a/sys/altq/altq_priq.h b/sys/altq/altq_priq.h
index 14f5f4b9f84..b4bbf3a1759 100644
--- a/sys/altq/altq_priq.h
+++ b/sys/altq/altq_priq.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: altq_priq.h,v 1.7 2011/07/03 22:39:12 tedu Exp $ */
+/* $OpenBSD: altq_priq.h,v 1.8 2011/07/03 23:48:41 henning Exp $ */
/* $KAME: altq_priq.h,v 1.1 2000/10/18 09:15:23 kjc Exp $ */
/*
* Copyright (C) 2000-2002
@@ -43,7 +43,6 @@ extern "C" {
#define PRCF_RED 0x0001 /* use RED */
#define PRCF_ECN 0x0002 /* use RED/ECN */
#define PRCF_RIO 0x0004 /* use RIO */
-#define PRCF_CLEARDSCP 0x0010 /* clear diffserv codepoint */
#define PRCF_DEFAULTCLASS 0x1000 /* default class */
/* special class handles */
diff --git a/sys/altq/altq_rmclass.c b/sys/altq/altq_rmclass.c
index 7efaaa46108..bce7c82ad17 100644
--- a/sys/altq/altq_rmclass.c
+++ b/sys/altq/altq_rmclass.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: altq_rmclass.c,v 1.16 2011/07/03 22:39:12 tedu Exp $ */
+/* $OpenBSD: altq_rmclass.c,v 1.17 2011/07/03 23:48:41 henning Exp $ */
/* $KAME: altq_rmclass.c,v 1.10 2001/02/09 07:20:40 kjc Exp $ */
/*
@@ -252,10 +252,6 @@ rmc_newclass(int pri, struct rm_ifdat *ifd, u_int nsecPerByte,
red_flags |= REDF_ECN;
if (flags & RMCF_FLOWVALVE)
red_flags |= REDF_FLOWVALVE;
-#ifdef ALTQ_RIO
- if (flags & RMCF_CLEARDSCP)
- red_flags |= RIOF_CLEARDSCP;
-#endif
red_pkttime = nsecPerByte * pktsize / 1000;
if (flags & RMCF_RED) {
@@ -1550,9 +1546,6 @@ _rmc_addq(rm_class_t *cl, mbuf_t *m)
return red_addq(cl->red_, cl->q_, m, cl->pktattr_);
#endif /* ALTQ_RED */
- if (cl->flags_ & RMCF_CLEARDSCP)
- write_dsfield(m, cl->pktattr_, 0);
-
_addq(cl->q_, m);
return (0);
}
diff --git a/sys/altq/altq_rmclass.h b/sys/altq/altq_rmclass.h
index 7ed6191bf22..39ea2962013 100644
--- a/sys/altq/altq_rmclass.h
+++ b/sys/altq/altq_rmclass.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: altq_rmclass.h,v 1.11 2008/08/27 01:37:16 deraadt Exp $ */
+/* $OpenBSD: altq_rmclass.h,v 1.12 2011/07/03 23:48:41 henning Exp $ */
/* $KAME: altq_rmclass.h,v 1.6 2000/12/09 09:22:44 kjc Exp $ */
/*
@@ -231,7 +231,6 @@ struct rm_ifdat {
#define RMCF_ECN 0x0002
#define RMCF_RIO 0x0004
#define RMCF_FLOWVALVE 0x0008 /* use flowvalve (aka penalty-box) */
-#define RMCF_CLEARDSCP 0x0010 /* clear diffserv codepoint */
/* flags for rmc_init */
#define RMCF_WRR 0x0100
diff --git a/sys/altq/altq_subr.c b/sys/altq/altq_subr.c
index 9fc5b874923..9c62920a605 100644
--- a/sys/altq/altq_subr.c
+++ b/sys/altq/altq_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: altq_subr.c,v 1.26 2008/05/09 14:10:05 dlg Exp $ */
+/* $OpenBSD: altq_subr.c,v 1.27 2011/07/03 23:48:41 henning Exp $ */
/* $KAME: altq_subr.c,v 1.11 2002/01/11 08:11:49 kjc Exp $ */
/*
@@ -575,121 +575,6 @@ altq_getqstats(struct pf_altq *a, void *ubuf, int *nbytes)
return (error);
}
-/*
- * read and write diffserv field in IPv4 or IPv6 header
- */
-u_int8_t
-read_dsfield(m, pktattr)
- struct mbuf *m;
- struct altq_pktattr *pktattr;
-{
- struct mbuf *m0;
- u_int8_t ds_field = 0;
-
- if (pktattr == NULL ||
- (pktattr->pattr_af != AF_INET && pktattr->pattr_af != AF_INET6))
- return ((u_int8_t)0);
-
- /* verify that pattr_hdr is within the mbuf data */
- for (m0 = m; m0 != NULL; m0 = m0->m_next)
- if ((pktattr->pattr_hdr >= m0->m_data) &&
- (pktattr->pattr_hdr < m0->m_data + m0->m_len))
- break;
- if (m0 == NULL) {
- /* ick, pattr_hdr is stale */
- pktattr->pattr_af = AF_UNSPEC;
-#ifdef ALTQ_DEBUG
- printf("read_dsfield: can't locate header!\n");
-#endif
- return ((u_int8_t)0);
- }
-
- if (pktattr->pattr_af == AF_INET) {
- struct ip *ip = (struct ip *)pktattr->pattr_hdr;
-
- if (ip->ip_v != 4)
- return ((u_int8_t)0); /* version mismatch! */
- ds_field = ip->ip_tos;
- }
-#ifdef INET6
- else if (pktattr->pattr_af == AF_INET6) {
- struct ip6_hdr *ip6 = (struct ip6_hdr *)pktattr->pattr_hdr;
- u_int32_t flowlabel;
-
- flowlabel = ntohl(ip6->ip6_flow);
- if ((flowlabel >> 28) != 6)
- return ((u_int8_t)0); /* version mismatch! */
- ds_field = (flowlabel >> 20) & 0xff;
- }
-#endif
- return (ds_field);
-}
-
-void
-write_dsfield(m, pktattr, dsfield)
- struct mbuf *m;
- struct altq_pktattr *pktattr;
- u_int8_t dsfield;
-{
- struct mbuf *m0;
-
- if (pktattr == NULL ||
- (pktattr->pattr_af != AF_INET && pktattr->pattr_af != AF_INET6))
- return;
-
- /* verify that pattr_hdr is within the mbuf data */
- for (m0 = m; m0 != NULL; m0 = m0->m_next)
- if ((pktattr->pattr_hdr >= m0->m_data) &&
- (pktattr->pattr_hdr < m0->m_data + m0->m_len))
- break;
- if (m0 == NULL) {
- /* ick, pattr_hdr is stale */
- pktattr->pattr_af = AF_UNSPEC;
-#ifdef ALTQ_DEBUG
- printf("write_dsfield: can't locate header!\n");
-#endif
- return;
- }
-
- if (pktattr->pattr_af == AF_INET) {
- struct ip *ip = (struct ip *)pktattr->pattr_hdr;
- u_int8_t old;
- int32_t sum;
-
- if (ip->ip_v != 4)
- return; /* version mismatch! */
- old = ip->ip_tos;
- dsfield |= old & 3; /* leave CU bits */
- if (old == dsfield)
- return;
- ip->ip_tos = dsfield;
- /*
- * update checksum (from RFC1624)
- * HC' = ~(~HC + ~m + m')
- */
- sum = ~ntohs(ip->ip_sum) & 0xffff;
- sum += 0xff00 + (~old & 0xff) + dsfield;
- sum = (sum >> 16) + (sum & 0xffff);
- sum += (sum >> 16); /* add carry */
-
- ip->ip_sum = htons(~sum & 0xffff);
- }
-#ifdef INET6
- else if (pktattr->pattr_af == AF_INET6) {
- struct ip6_hdr *ip6 = (struct ip6_hdr *)pktattr->pattr_hdr;
- u_int32_t flowlabel;
-
- flowlabel = ntohl(ip6->ip6_flow);
- if ((flowlabel >> 28) != 6)
- return; /* version mismatch! */
- flowlabel = (flowlabel & 0xf03fffff) | (dsfield << 20);
- ip6->ip6_flow = htonl(flowlabel);
- }
-#endif
- return;
-}
-
-
#define MACHCLK_SHIFT 8
u_int32_t machclk_tc = 0;
diff --git a/sys/altq/altq_var.h b/sys/altq/altq_var.h
index f7f617523f6..f01ab9c03b2 100644
--- a/sys/altq/altq_var.h
+++ b/sys/altq/altq_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: altq_var.h,v 1.15 2008/04/20 07:05:52 deraadt Exp $ */
+/* $OpenBSD: altq_var.h,v 1.16 2011/07/03 23:48:41 henning Exp $ */
/* $KAME: altq_var.h,v 1.8 2001/02/09 09:44:41 kjc Exp $ */
/*
@@ -97,7 +97,6 @@ struct ifnet; struct mbuf;
struct pf_altq; struct pf_qstats;
void *altq_lookup(char *, int);
-u_int8_t read_dsfield(struct mbuf *, struct altq_pktattr *);
void write_dsfield(struct mbuf *, struct altq_pktattr *, u_int8_t);
void altq_assert(const char *, int, const char *);
int tbr_set(struct ifaltq *, struct tb_profile *);