mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-28 16:43:09 +00:00
fix up socket/ip layer violation... don't assume/know that
SO_DONTROUTE == IP_ROUTETOIF and SO_BROADCAST == IP_ALLOWBROADCAST...
This commit is contained in:
parent
bce73aeddb
commit
b5d47ff592
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=134793
@ -333,7 +333,8 @@ div_output(struct socket *so, struct mbuf *m,
|
||||
#endif
|
||||
error = ip_output(m,
|
||||
inp->inp_options, NULL,
|
||||
(so->so_options & SO_DONTROUTE) |
|
||||
((so->so_options & SO_DONTROUTE) ?
|
||||
IP_ROUTETOIF : 0) |
|
||||
IP_ALLOWBROADCAST | IP_RAWOUTPUT,
|
||||
inp->inp_moptions, NULL);
|
||||
}
|
||||
|
@ -249,7 +249,8 @@ rip_output(struct mbuf *m, struct socket *so, u_long dst)
|
||||
struct ip *ip;
|
||||
int error;
|
||||
struct inpcb *inp = sotoinpcb(so);
|
||||
int flags = (so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST;
|
||||
int flags = ((so->so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0) |
|
||||
IP_ALLOWBROADCAST;
|
||||
|
||||
/*
|
||||
* If the user handed us a complete IP packet, use it.
|
||||
|
@ -1060,8 +1060,8 @@ tcp_output(struct tcpcb *tp)
|
||||
/* TODO: IPv6 IP6TOS_ECT bit on */
|
||||
error = ip6_output(m,
|
||||
tp->t_inpcb->in6p_outputopts, NULL,
|
||||
(so->so_options & SO_DONTROUTE), NULL, NULL,
|
||||
tp->t_inpcb);
|
||||
((so->so_options & SO_DONTROUTE) ?
|
||||
IP_ROUTETOIF : 0), NULL, NULL, tp->t_inpcb);
|
||||
} else
|
||||
#endif /* INET6 */
|
||||
{
|
||||
@ -1080,7 +1080,8 @@ tcp_output(struct tcpcb *tp)
|
||||
ip->ip_off |= IP_DF;
|
||||
|
||||
error = ip_output(m, tp->t_inpcb->inp_options, NULL,
|
||||
(so->so_options & SO_DONTROUTE), 0, tp->t_inpcb);
|
||||
((so->so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0), 0,
|
||||
tp->t_inpcb);
|
||||
}
|
||||
if (error) {
|
||||
|
||||
|
@ -1848,7 +1848,8 @@ tcp_twrespond(struct tcptw *tw, int flags)
|
||||
if (path_mtu_discovery)
|
||||
ip->ip_off |= IP_DF;
|
||||
error = ip_output(m, inp->inp_options, NULL,
|
||||
(tw->tw_so_options & SO_DONTROUTE), NULL, inp);
|
||||
((tw->tw_so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0),
|
||||
NULL, inp);
|
||||
}
|
||||
if (flags & TH_ACK)
|
||||
tcpstat.tcps_sndacks++;
|
||||
|
@ -1848,7 +1848,8 @@ tcp_twrespond(struct tcptw *tw, int flags)
|
||||
if (path_mtu_discovery)
|
||||
ip->ip_off |= IP_DF;
|
||||
error = ip_output(m, inp->inp_options, NULL,
|
||||
(tw->tw_so_options & SO_DONTROUTE), NULL, inp);
|
||||
((tw->tw_so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0),
|
||||
NULL, inp);
|
||||
}
|
||||
if (flags & TH_ACK)
|
||||
tcpstat.tcps_sndacks++;
|
||||
|
@ -879,7 +879,11 @@ udp_output(inp, m, addr, control, td)
|
||||
ui->ui_dport = fport;
|
||||
ui->ui_ulen = htons((u_short)len + sizeof(struct udphdr));
|
||||
|
||||
ipflags = inp->inp_socket->so_options & (SO_DONTROUTE | SO_BROADCAST);
|
||||
ipflags = 0;
|
||||
if (inp->inp_socket->so_options & SO_DONTROUTE)
|
||||
ipflags |= IP_ROUTETOIF;
|
||||
if (inp->inp_socket->so_options & SO_BROADCAST)
|
||||
ipflags |= IP_ALLOWBROADCAST;
|
||||
if (inp->inp_flags & INP_ONESBCAST)
|
||||
ipflags |= IP_SENDONES;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user