diff options
author | ru <ru@FreeBSD.org> | 2001-03-09 12:22:51 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2001-03-09 12:22:51 +0000 |
commit | 5639e86bdd7ea151958776264bf5a67e60a54d68 (patch) | |
tree | 1d73781da1735907de40d8e269df8529fc4b271e /sys | |
parent | a64bcb9cca89e37fd4482228915951f0fbd2d538 (diff) | |
download | FreeBSD-src-5639e86bdd7ea151958776264bf5a67e60a54d68.zip FreeBSD-src-5639e86bdd7ea151958776264bf5a67e60a54d68.tar.gz |
Make it possible to use IP_TTL and IP_TOS setsockopt(2) options
on certain types of SOCK_RAW sockets. Also, use the ip.ttl MIB
variable instead of MAXTTL constant as the default time-to-live
value for outgoing IP packets all over the place, as we already
do this for TCP and UDP.
Reviewed by: wollman
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet/ip_icmp.c | 2 | ||||
-rw-r--r-- | sys/netinet/raw_ip.c | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index bdcc884..95b7197b 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -638,7 +638,7 @@ icmp_reflect(m) ia = TAILQ_FIRST(&in_ifaddrhead); t = IA_SIN(ia)->sin_addr; ip->ip_src = t; - ip->ip_ttl = MAXTTL; + ip->ip_ttl = ip_defttl; if (optlen > 0) { register u_char *cp; diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index a6e850f..8d5c6d1 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -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, struct proc *p) inp = (struct inpcb *)so->so_pcb; inp->inp_vflag |= INP_IPV4; inp->inp_ip_p = proto; + inp->inp_ip_ttl = ip_defttl; #ifdef IPSEC error = ipsec_init_policy(so, &inp->inp_sp); if (error != 0) { |