The network stack has been modified to fix incorrect or invalid IP

addresses if multiple threads emit a UDP log_in_vain message
concurrently.

Corresponding upstream changeset from
https://svnweb.freebsd.org/base?view=revision&revision=313523.
dev
fengbojiang(姜凤波) 2019-11-21 16:57:10 +08:00
parent d6e6a7ee89
commit 56d87bf891
1 changed files with 4 additions and 4 deletions

View File

@ -674,13 +674,13 @@ udp_input(struct mbuf **mp, int *offp, int proto)
INPLOOKUP_RLOCKPCB, ifp, m);
if (inp == NULL) {
if (udp_log_in_vain) {
char buf[4*sizeof "123"];
char src[INET_ADDRSTRLEN];
char dst[INET_ADDRSTRLEN];
strcpy(buf, inet_ntoa(ip->ip_dst));
log(LOG_INFO,
"Connection attempt to UDP %s:%d from %s:%d\n",
buf, ntohs(uh->uh_dport), inet_ntoa(ip->ip_src),
ntohs(uh->uh_sport));
inet_ntoa_r(ip->ip_dst, dst), ntohs(uh->uh_dport),
inet_ntoa_r(ip->ip_src, src), ntohs(uh->uh_sport));
}
UDPSTAT_INC(udps_noport);
if (m->m_flags & (M_BCAST | M_MCAST)) {