Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

setting DiffServ in network packets under Linux???

Bill Bogstad writes:

> On Wed, Jan 6, 2010 at 4:36 PM, Bill Bogstad  wrote:
> > Does anybody have any idea if there is a programmatic way to set the
> > DiffServ (Differentiated Services Code Point (DSCP)) field on IP
> > packets generated by programs running under Linux?
> Never mind.   It appears that you can use setsockopt() with IPPROTO_IP
> and IP_TOS options to do this.
> At least that's what the documentation seems to say.

At a previous company, I experimented around with doing this via
setsockopt(...IP_TOS...) and via iptables.  Either way works.

Eventually, I determined (for myself) that doing this via iptables was
better (for my situation) because setsockopt(...IP_TOS...) requires
root privileges, and I wanted to minimize the number of places in
which my server had to run as root.

(in fact, soon after the time that I added this iptables stuff to our
product I also I added code to my server that disallowed it from
being run as root, unless the
"--i-want-to-run-this-server-incorrectly-as-root" flag was set...I
recommend this pattern...)


--!kdc                God, I loved that Pontiac.         -- Tom Waits

GnuPG: D87F DAD6 0291 289C EB1E 781C 9BF8 A7D8 B280 F24E 

BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!

Boston Linux & Unix /