mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-17 15:27:36 +00:00
Fix a scope problem in the multiple routing table code that stopped the
SO_SETFIB socket option from working correctly. Obtained from: Ironport MFC after: 3 days
This commit is contained in:
parent
11cdd0c0c2
commit
bc97ba5100
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=185101
@ -2218,6 +2218,9 @@ sosetopt(struct socket *so, struct sockopt *sopt)
|
||||
if ((so->so_proto->pr_domain->dom_family == PF_INET) ||
|
||||
(so->so_proto->pr_domain->dom_family == PF_ROUTE)) {
|
||||
so->so_fibnum = optval;
|
||||
/* Note: ignore error */
|
||||
if (so->so_proto && so->so_proto->pr_ctloutput)
|
||||
(*so->so_proto->pr_ctloutput)(so, sopt);
|
||||
} else {
|
||||
so->so_fibnum = 0;
|
||||
}
|
||||
|
@ -322,6 +322,7 @@ div_output(struct socket *so, struct mbuf *m, struct sockaddr_in *sin,
|
||||
*/
|
||||
m->m_pkthdr.rcvif = NULL;
|
||||
m->m_nextpkt = NULL;
|
||||
M_SETFIB(m, so->so_fibnum);
|
||||
|
||||
if (control)
|
||||
m_freem(control); /* XXX */
|
||||
|
@ -134,8 +134,10 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags,
|
||||
bzero(ro, sizeof (*ro));
|
||||
}
|
||||
|
||||
if (inp != NULL)
|
||||
if (inp != NULL) {
|
||||
M_SETFIB(m, inp->inp_inc.inc_fibnum);
|
||||
INP_LOCK_ASSERT(inp);
|
||||
}
|
||||
|
||||
if (opt) {
|
||||
len = 0;
|
||||
@ -824,6 +826,11 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt)
|
||||
|
||||
error = optval = 0;
|
||||
if (sopt->sopt_level != IPPROTO_IP) {
|
||||
if ((sopt->sopt_level == SOL_SOCKET) &&
|
||||
(sopt->sopt_name == SO_SETFIB)) {
|
||||
inp->inp_inc.inc_fibnum = so->so_fibnum;
|
||||
return (0);
|
||||
}
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
|
@ -450,8 +450,14 @@ rip_ctloutput(struct socket *so, struct sockopt *sopt)
|
||||
struct inpcb *inp = sotoinpcb(so);
|
||||
int error, optval;
|
||||
|
||||
if (sopt->sopt_level != IPPROTO_IP)
|
||||
if (sopt->sopt_level != IPPROTO_IP) {
|
||||
if ((sopt->sopt_level == SOL_SOCKET) &&
|
||||
(sopt->sopt_name == SO_SETFIB)) {
|
||||
inp->inp_inc.inc_fibnum = so->so_fibnum;
|
||||
return (0);
|
||||
}
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
error = 0;
|
||||
switch (sopt->sopt_dir) {
|
||||
|
Loading…
Reference in New Issue
Block a user