Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Oct 1999 01:58:53 -0700 (PDT)
From:      wim.livens@alcatel.be
To:        freebsd-gnats-submit@freebsd.org
Subject:   misc/14258: IP_TOS and IP_TTL sockopt doesn't work on raw socket
Message-ID:  <19991011085853.4C24014D52@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         14258
>Category:       misc
>Synopsis:       IP_TOS and IP_TTL sockopt doesn't work on raw socket
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 11 02:00:01 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator:     Wim Livens
>Release:        2.2.8-RELEASE
>Organization:
Alcatel
>Environment:
FreeBSD btm22v.rc.bel.alcatel.be 2.2.8-RELEASE FreeBSD 2.2.8-RELEASE #5: Fri Oct  8 15:54:19 CEST 1999     livensw@btm22v.rc.bel.alcatel.be:/home/users/livensw/work/sys/compile/ALTQ  i386
>Description:
I've noticed that the IP_TOS socket option doesn't work on raw
sockets.  There is no error returned and the TOS is stored in the
protocol control block but when the packet headers are constructed, a
hardcoded zero is put (instead of inp->inp_ip_tos). The same holds 
for the ttl.

>How-To-Repeat:
do something like :
 sendsock=socket(AF_INET, SOCK_RAW, IPPROTO_OSPFIGP);
 tos=0xf0;
 if(setsockopt(sendsock, IPPROTO_IP, IP_TOS, (void*)&tos, 4) ==  -1)
    { printf("can't set tos bits\n"); exit(1); }
 sendto(sendsock, &sendbuf, 12, 0, (struct sockaddr *) &dest, 16);

Then look with tcpdump and you'll see that tos is still zero.

>Fix:
change the following line rip_output(m, so, dst): (in netinet/raw_ip.c)
                ip->ip_tos = 0;
to
                ip->ip_tos = inp->inp_ip_tos;

(similar for ip_ttl)

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991011085853.4C24014D52>