OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: ALTQ conditioners (openBSD 3.2 stable)

From: Kenjiro Cho (kjccsl.sony.co.jp)
Date: Fri May 02 2003 - 01:29:58 CDT


Mathew S <mathewsssyahoo.com> wrote:
> When I look at "altqstat -I xl0" the HTTP packets are never marked.
> They are always passed through without any marking.
> I also looked at the packet sniffer on the 20.0.1.0 network
> and the HTTP packets coming from 10.0.1.5 are not marked.

It is my oversight.
altq expects the ip_off field in the network byte order but the field
is actually in the host byte order after the altq hook was moved below
the pf hook. As a result, when port numbers are specified, altq
checks the ip_off filed and thinks the DF bit as a frag offset.

The attached patch to sys/netinet/ip_input.c should fix it.
(3.3 doesn't have this part of the code.)

-Kenjiro

--- ip_input.c- Fri May 2 15:09:09 2003
+++ ip_input.c Fri May 2 15:11:01 2003
-402,9 +402,16
 #endif
 
 #ifdef ALTQ
- if (altq_input != NULL && (*altq_input)(m, AF_INET) == 0)
- /* packet is dropped by traffic conditioner */
- return;
+ if (altq_input != NULL) {
+ int rv;
+
+ /* altq expects ip_off in the network order */
+ HTONS(ip->ip_off);
+ rv = (*altq_input)(m, AF_INET);
+ NTOHS(ip->ip_off);
+ if (rv == 0)
+ /* packet is dropped by traffic conditioner */
+ return;
 #endif
 
         /*