summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/contrib/pf/net/pf.c6
-rw-r--r--sys/netinet/udp_usrreq.c22
-rw-r--r--sys/netinet/udp_var.h5
3 files changed, 19 insertions, 14 deletions
diff --git a/sys/contrib/pf/net/pf.c b/sys/contrib/pf/net/pf.c
index 241f2b184371..7ecc2d3cb996 100644
--- a/sys/contrib/pf/net/pf.c
+++ b/sys/contrib/pf/net/pf.c
@@ -6293,7 +6293,7 @@ pf_route(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp,
if (m0->m_pkthdr.csum_flags & M_TCPV4_CSUM_OUT)
TCPSTAT_INC(tcpstat.tcps_outhwcsum);
else if (m0->m_pkthdr.csum_flags & M_UDPV4_CSUM_OUT)
- V_udpstat.udps_outhwcsum++;
+ UDPSTAT_INC(udps_outhwcsum);
error = (*ifp->if_output)(ifp, m0, sintosa(dst), NULL);
goto done;
}
@@ -6641,7 +6641,7 @@ pf_check_proto_cksum(struct mbuf *m, int off, int len, u_int8_t p, sa_family_t a
case IPPROTO_UDP:
{
INIT_VNET_INET(curvnet);
- V_udpstat.udps_badsum++;
+ UDPSTAT_INC(udps_badsum);
break;
}
case IPPROTO_ICMP:
@@ -6744,7 +6744,7 @@ pf_check_proto_cksum(struct mbuf *m, int off, int len, u_int8_t p,
TCPSTAT_INC(tcps_rcvbadsum);
break;
case IPPROTO_UDP:
- V_udpstat.udps_badsum++;
+ UDPSTAT_INC(udps_badsum);
break;
case IPPROTO_ICMP:
V_icmpstat.icps_checksum++;
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 2b92e24bc37e..084b48559a1d 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -254,7 +254,7 @@ udp_append(struct inpcb *inp, struct ip *ip, struct mbuf *n, int off,
m_freem(n);
if (opts)
m_freem(opts);
- V_udpstat.udps_fullsock++;
+ UDPSTAT_INC(udps_fullsock);
} else
sorwakeup_locked(so);
}
@@ -276,7 +276,7 @@ udp_input(struct mbuf *m, int off)
#endif
ifp = m->m_pkthdr.rcvif;
- V_udpstat.udps_ipackets++;
+ UDPSTAT_INC(udps_ipackets);
/*
* Strip IP options, if any; should skip this, make available to
@@ -294,7 +294,7 @@ udp_input(struct mbuf *m, int off)
ip = mtod(m, struct ip *);
if (m->m_len < iphlen + sizeof(struct udphdr)) {
if ((m = m_pullup(m, iphlen + sizeof(struct udphdr))) == 0) {
- V_udpstat.udps_hdrops++;
+ UDPSTAT_INC(udps_hdrops);
return;
}
ip = mtod(m, struct ip *);
@@ -324,7 +324,7 @@ udp_input(struct mbuf *m, int off)
len = ntohs((u_short)uh->uh_ulen);
if (ip->ip_len != len) {
if (len > ip->ip_len || len < sizeof(struct udphdr)) {
- V_udpstat.udps_badlen++;
+ UDPSTAT_INC(udps_badlen);
goto badunlocked;
}
m_adj(m, len - ip->ip_len);
@@ -364,12 +364,12 @@ udp_input(struct mbuf *m, int off)
bcopy(b, ((struct ipovly *)ip)->ih_x1, 9);
}
if (uh_sum) {
- V_udpstat.udps_badsum++;
+ UDPSTAT_INC(udps_badsum);
m_freem(m);
return;
}
} else
- V_udpstat.udps_nosum++;
+ UDPSTAT_INC(udps_nosum);
#ifdef IPFIREWALL_FORWARD
/*
@@ -442,7 +442,7 @@ udp_input(struct mbuf *m, int off)
IPSTAT_INC(ips_notmember);
if (blocked == MCAST_NOTSMEMBER ||
blocked == MCAST_MUTED)
- V_udpstat.udps_filtermcast++;
+ UDPSTAT_INC(udps_filtermcast);
INP_RUNLOCK(inp);
continue;
}
@@ -494,7 +494,7 @@ udp_input(struct mbuf *m, int off)
* to send an ICMP Port Unreachable for a broadcast
* or multicast datgram.)
*/
- V_udpstat.udps_noportbcast++;
+ UDPSTAT_INC(udps_noportbcast);
goto badheadlocked;
}
if (last->inp_ppcb == NULL) {
@@ -531,9 +531,9 @@ udp_input(struct mbuf *m, int off)
buf, ntohs(uh->uh_dport), inet_ntoa(ip->ip_src),
ntohs(uh->uh_sport));
}
- V_udpstat.udps_noport++;
+ UDPSTAT_INC(udps_noport);
if (m->m_flags & (M_BCAST | M_MCAST)) {
- V_udpstat.udps_noportbcast++;
+ UDPSTAT_INC(udps_noportbcast);
goto badheadlocked;
}
if (V_udp_blackhole)
@@ -1072,7 +1072,7 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr,
((struct ip *)ui)->ip_len = sizeof (struct udpiphdr) + len;
((struct ip *)ui)->ip_ttl = inp->inp_ip_ttl; /* XXX */
((struct ip *)ui)->ip_tos = inp->inp_ip_tos; /* XXX */
- V_udpstat.udps_opackets++;
+ UDPSTAT_INC(udps_opackets);
if (unlock_udbinfo == 2)
INP_INFO_WUNLOCK(&V_udbinfo);
diff --git a/sys/netinet/udp_var.h b/sys/netinet/udp_var.h
index 76a31b890679..d83f705f58a6 100644
--- a/sys/netinet/udp_var.h
+++ b/sys/netinet/udp_var.h
@@ -71,6 +71,11 @@ struct udpstat {
u_long udps_filtermcast; /* blocked by multicast filter */
};
+#ifdef _KERNEL
+#define UDPSTAT_ADD(name, val) V_udpstat.name += (val)
+#define UDPSTAT_INC(name) UDPSTAT_ADD(name, 1)
+#endif
+
/*
* Names for UDP sysctl objects.
*/