mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-14 22:15:19 +08:00
Update to FreeBSD head 2018-06-01
Git mirror commit fb63610a69b0eb7f69a201ba05c4c1a7a2739cf9. Update #3472.
This commit is contained in:
@@ -745,7 +745,7 @@ rip_ctlinput(int cmd, struct sockaddr *sa, void *vip)
|
||||
switch (cmd) {
|
||||
case PRC_IFDOWN:
|
||||
IN_IFADDR_RLOCK(&in_ifa_tracker);
|
||||
TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) {
|
||||
CK_STAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) {
|
||||
if (ia->ia_ifa.ifa_addr == sa
|
||||
&& (ia->ia_flags & IFA_ROUTE)) {
|
||||
ifa_ref(&ia->ia_ifa);
|
||||
@@ -771,7 +771,7 @@ rip_ctlinput(int cmd, struct sockaddr *sa, void *vip)
|
||||
|
||||
case PRC_IFUP:
|
||||
IN_IFADDR_RLOCK(&in_ifa_tracker);
|
||||
TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) {
|
||||
CK_STAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) {
|
||||
if (ia->ia_ifa.ifa_addr == sa)
|
||||
break;
|
||||
}
|
||||
@@ -853,6 +853,7 @@ rip_detach(struct socket *so)
|
||||
ip_rsvp_force_done(so);
|
||||
if (so == V_ip_rsvpd)
|
||||
ip_rsvp_done();
|
||||
/* XXX defer to epoch_call */
|
||||
in_pcbdetach(inp);
|
||||
in_pcbfree(inp);
|
||||
INP_INFO_WUNLOCK(&V_ripcbinfo);
|
||||
@@ -930,7 +931,7 @@ rip_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
|
||||
inp = sotoinpcb(so);
|
||||
KASSERT(inp != NULL, ("rip_bind: inp == NULL"));
|
||||
|
||||
if (TAILQ_EMPTY(&V_ifnet) ||
|
||||
if (CK_STAILQ_EMPTY(&V_ifnet) ||
|
||||
(addr->sin_family != AF_INET && addr->sin_family != AF_IMPLINK) ||
|
||||
(addr->sin_addr.s_addr &&
|
||||
(inp->inp_flags & INP_BINDANY) == 0 &&
|
||||
@@ -955,7 +956,7 @@ rip_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
|
||||
|
||||
if (nam->sa_len != sizeof(*addr))
|
||||
return (EINVAL);
|
||||
if (TAILQ_EMPTY(&V_ifnet))
|
||||
if (CK_STAILQ_EMPTY(&V_ifnet))
|
||||
return (EADDRNOTAVAIL);
|
||||
if (addr->sin_family != AF_INET && addr->sin_family != AF_IMPLINK)
|
||||
return (EAFNOSUPPORT);
|
||||
@@ -1022,6 +1023,7 @@ static int
|
||||
rip_pcblist(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
int error, i, n;
|
||||
struct in_pcblist *il;
|
||||
struct inpcb *inp, **inp_list;
|
||||
inp_gen_t gencnt;
|
||||
struct xinpgen xig;
|
||||
@@ -1056,9 +1058,8 @@ rip_pcblist(SYSCTL_HANDLER_ARGS)
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK);
|
||||
if (inp_list == NULL)
|
||||
return (ENOMEM);
|
||||
il = malloc(sizeof(struct in_pcblist) + n * sizeof(struct inpcb *), M_TEMP, M_WAITOK|M_ZERO_INVARIANTS);
|
||||
inp_list = il->il_inp_list;
|
||||
|
||||
INP_INFO_RLOCK(&V_ripcbinfo);
|
||||
for (inp = LIST_FIRST(V_ripcbinfo.ipi_listhead), i = 0; inp && i < n;
|
||||
@@ -1087,14 +1088,9 @@ rip_pcblist(SYSCTL_HANDLER_ARGS)
|
||||
} else
|
||||
INP_RUNLOCK(inp);
|
||||
}
|
||||
INP_INFO_WLOCK(&V_ripcbinfo);
|
||||
for (i = 0; i < n; i++) {
|
||||
inp = inp_list[i];
|
||||
INP_RLOCK(inp);
|
||||
if (!in_pcbrele_rlocked(inp))
|
||||
INP_RUNLOCK(inp);
|
||||
}
|
||||
INP_INFO_WUNLOCK(&V_ripcbinfo);
|
||||
il->il_count = n;
|
||||
il->il_pcbinfo = &V_ripcbinfo;
|
||||
epoch_call(net_epoch_preempt, &il->il_epoch_ctx, in_pcblist_rele_rlocked);
|
||||
|
||||
if (!error) {
|
||||
/*
|
||||
@@ -1110,7 +1106,6 @@ rip_pcblist(SYSCTL_HANDLER_ARGS)
|
||||
INP_INFO_RUNLOCK(&V_ripcbinfo);
|
||||
error = SYSCTL_OUT(req, &xig, sizeof xig);
|
||||
}
|
||||
free(inp_list, M_TEMP);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user