Date: Wed, 7 Mar 2001 16:32:00 +0200 From: Ruslan Ermilov <ru@FreeBSD.org> To: net@FreeBSD.org Subject: [PATCH] IP_TTL, IP_TOS, and raw IP sockets Message-ID: <20010307163200.A97252@sunbay.com>
next in thread | raw e-mail | index | archive | help
--gKMricLos+KVdGMg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi! IP_TTL and IP_TOS setsockopt(2) options currently do not take any effect on raw IP sockets (actually, everything that uses rip_usrreqs function set). The attached patch fixes this. Also, I have the question. Should we use MAXTTL constant or net.inet.ip.ttl MIB variable, as the initial value for TTL? Finally, if anyone has any objections, send them now. Cheers, -- Ruslan Ermilov Oracle Developer/DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age --gKMricLos+KVdGMg Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=p Index: raw_ip.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/raw_ip.c,v retrieving revision 1.73 diff -u -p -r1.73 raw_ip.c --- raw_ip.c 2001/02/04 13:13:08 1.73 +++ raw_ip.c 2001/03/07 14:26:12 @@ -197,13 +197,13 @@ rip_output(m, so, dst) } M_PREPEND(m, sizeof(struct ip), M_TRYWAIT); ip = mtod(m, struct ip *); - ip->ip_tos = 0; + ip->ip_tos = inp->inp_ip_tos; ip->ip_off = 0; ip->ip_p = inp->inp_ip_p; ip->ip_len = m->m_pkthdr.len; ip->ip_src = inp->inp_laddr; ip->ip_dst.s_addr = dst; - ip->ip_ttl = MAXTTL; + ip->ip_ttl = inp->inp_ip_ttl; } else { if (m->m_pkthdr.len > IP_MAXPACKET) { m_freem(m); @@ -458,6 +458,7 @@ rip_attach(struct socket *so, int proto, inp = (struct inpcb *)so->so_pcb; inp->inp_vflag |= INP_IPV4; inp->inp_ip_p = proto; + inp->inp_ip_ttl = MAXTTL; #ifdef IPSEC error = ipsec_init_policy(so, &inp->inp_sp); if (error != 0) { --gKMricLos+KVdGMg-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010307163200.A97252>