From owner-freebsd-bugs Mon Oct 11 2: 0: 6 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 828C614E7A for ; Mon, 11 Oct 1999 02:00:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id CAA46326; Mon, 11 Oct 1999 02:00:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: by hub.freebsd.org (Postfix, from userid 32767) id 4C24014D52; Mon, 11 Oct 1999 01:58:53 -0700 (PDT) Message-Id: <19991011085853.4C24014D52@hub.freebsd.org> Date: Mon, 11 Oct 1999 01:58:53 -0700 (PDT) From: wim.livens@alcatel.be To: freebsd-gnats-submit@freebsd.org X-Send-Pr-Version: www-1.0 Subject: misc/14258: IP_TOS and IP_TTL sockopt doesn't work on raw socket Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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