Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F168234541
D2141.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D2141.diff
View Options
Index: netinet/ip_output.c
===================================================================
--- netinet/ip_output.c
+++ netinet/ip_output.c
@@ -91,7 +91,7 @@
#include <security/mac/mac_framework.h>
-VNET_DEFINE(u_short, ip_id);
+VNET_DEFINE(u_int32_t, ip_id);
#ifdef MBUF_STRESS_TEST
static int mbuf_frag_size = 0;
Index: netinet/ip_var.h
===================================================================
--- netinet/ip_var.h
+++ netinet/ip_var.h
@@ -174,7 +174,7 @@
struct route;
struct sockopt;
-VNET_DECLARE(u_short, ip_id); /* ip packet ctr, for ids */
+VNET_DECLARE(u_int32_t, ip_id); /* ip packet ctr, for ids */
VNET_DECLARE(int, ip_defttl); /* default IP ttl */
VNET_DECLARE(int, ipforwarding); /* ip forwarding */
#ifdef IPSTEALTH
@@ -305,9 +305,19 @@
VNET_DECLARE(int, ip_do_randomid);
#define V_ip_do_randomid VNET(ip_do_randomid)
-#define ip_newid() ((V_ip_do_randomid != 0) ? ip_randomid() : \
- htons(V_ip_id++))
+static __inline u_int16_t
+ip_newid(void)
+{
+ u_int16_t res;
+ if (V_ip_do_randomid != 0)
+ return ip_randomid();
+ else {
+ res = atomic_fetchadd_32(&V_ip_id, 1) & 0xFFFF;
+ return htons(res);
+ }
+}
+
#endif /* _KERNEL */
#endif /* !_NETINET_IP_VAR_H_ */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Aug 28, 2:25 AM (8 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37429390
Default Alt Text
D2141.diff (1 KB)
Attached To
Mode
D2141: Fix ip_id concurrent access
Attached
Detach File
Event Timeline
Log In to Comment