Re: changing the ToS in IP Header

From: Ashish Kulkarni (ashish_at_symonds.net)
Date: 05/26/03

  • Next message: Terry Lambert: "Re: Change request for mount_null manpage"
    Date: Tue, 27 May 2003 00:50:46 +0530 (IST)
    To: <freebsd-hackers@freebsd.org>
    
    

    as I mentioned earlier, I want to do it for all outgoing packets on an
    interface, not on per socket basis. I actually was hoping that somene
    would provide me pointers to where I should look in the source (me being a
    newcomer to BSD as such) to implement a sysctl that will allow me to
    change the tos, eg. "net.inet.ip.tos". I'd have prefered to use a packet
    mangling firewall, but afaik there are none which do that so I'll have to
    do it the hard way ;-)

    Thanks,
    Ashish

    ----- Original Message -----
    From: "Jerry Toung" <jtoung@mindspring.com>
    To: <ashish@symonds.net>; <freebsd-hackers@freebsd.org>
    Sent: Monday, May 26, 2003 9:36 PM
    Subject: Re: changing the ToS in IP Header

    Ashish,
    you can set the TOS bit when you create the socket in your program.

    int fd, tos;
    fd = socket(PF_INET, SOCK_DGRAM, 0)
    tos=3;
    setsockopt(fd,IPPROTO_IP,3, &tos, sizeof(tos))

    On Monday 26 May 2003 07:21 am, Ashish Kulkarni wrote:
    > Hello,
    >
    >
    > Is there any way in which I can manipulate the Type of Service (TOS) byte
    > in the IPv4 header? I need to set the TOS bits on all outgoing packets from
    > my box to the ISP to a particular pattern (0x02), as otherwise the ISP does
    > not forward packets. I have been able to do this in Linux using the
    > iptables mangle table:
    >
    >
    > http://www.tldp.org/LDP/nag2/x-087-2-firewall.tos.manipulation.html
    >
    >
    > but am unable to find a similiar packet-mangling feature in the firewalls
    > running on FreeBSD...there are rules for matching on TOS pattern, but not
    > on TOS manipulation. Does anyone know of any tool which can do this?
    >
    >
    > As an alternative solution, is there any way to set the default TOS via a
    > sysctl interface (similiar to that of TTL, namely net.inet.ip.ttl)? I'm
    > planning to use this on my home box, so I have no problems in trying to
    > patch and rebuild the kernel if I can get some feedback and/or tips on how
    > to do so :-)
    >
    >
    > Thanks,
    > Ashish.
    >
    >
    > ps: can you please CC any replies to me? thanks...
    >-

    _______________________________________________
    freebsd-hackers@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
    To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"


  • Next message: Terry Lambert: "Re: Change request for mount_null manpage"

    Relevant Pages

    • Re: IEEE 802.11 Wireless Multimedia Extension (WME) and raw sockets
      ... I've been playing around with WME to test various network performance, ... It uses raw sockets to transmit ... the IP packets. ... "BEST EFFORT" no matter what value my application set the TOS field as. ...
      (freebsd-net)
    • Re: IEEE 802.11 Wireless Multimedia Extension (WME) and raw sockets
      ... I've been playing around with WME to test various network performance, ... It uses raw sockets to transmit ... the IP packets. ... "BEST EFFORT" no matter what value my application set the TOS field as. ...
      (freebsd-questions)
    • Re: IPTABLES: TOS setting problems
      ... > I'm trying to get my linux router to set tos bits for Minimize Delay ... > According to the iptables counters, the packets are being matched OK - ... > Craig Jackson ...
      (comp.os.linux.networking)
    • changing the ToS in IP Header
      ... Is there any way in which I can manipulate the Type of Service (TOS) byte ... I need to set the TOS bits on all outgoing packets from ... but am unable to find a similiar packet-mangling feature in the firewalls ...
      (freebsd-hackers)
    • changing the ToS in IP Header
      ... Is there any way in which I can manipulate the Type of Service (TOS) byte ... I need to set the TOS bits on all outgoing packets from ... but am unable to find a similiar packet-mangling feature in the firewalls ...
      (freebsd-questions)