Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F101849709
D46259.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D46259.diff
View Options
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -234,6 +234,12 @@
VNET_SYSINIT(in_pcbhashseed_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_FIRST,
in_pcbhashseed_init, 0);
+VNET_DEFINE_STATIC(int, connect_inaddr_wild) = 1;
+#define V_connect_inaddr_wild VNET(connect_inaddr_wild)
+SYSCTL_INT(_net_inet_ip, OID_AUTO, connect_inaddr_wild,
+ CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(connect_inaddr_wild), 0,
+ "Allow connecting to INADDR_ANY or INADDR_BROADCAST for connect(2)");
+
static void in_pcbremhash(struct inpcb *);
/*
@@ -1309,7 +1315,7 @@
inp->inp_flowtype = hash_type;
}
#endif
- if (!CK_STAILQ_EMPTY(&V_in_ifaddrhead)) {
+ if (V_connect_inaddr_wild && !CK_STAILQ_EMPTY(&V_in_ifaddrhead)) {
/*
* If the destination address is INADDR_ANY,
* use the primary local address.
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -83,6 +83,7 @@
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/sockio.h>
+#include <sys/sysctl.h>
#include <sys/errno.h>
#include <sys/time.h>
#include <sys/priv.h>
@@ -97,6 +98,7 @@
#include <net/if_types.h>
#include <net/route.h>
#include <net/route/nhop.h>
+#include <net/vnet.h>
#include <netinet/in.h>
#include <netinet/in_var.h>
@@ -112,6 +114,14 @@
#include <netinet6/in6_fib.h>
#include <netinet6/scope6_var.h>
+SYSCTL_DECL(_net_inet6);
+SYSCTL_DECL(_net_inet6_ip6);
+VNET_DEFINE_STATIC(int, connect_in6addr_wild) = 1;
+#define V_connect_in6addr_wild VNET(connect_in6addr_wild)
+SYSCTL_INT(_net_inet6_ip6, OID_AUTO, connect_in6addr_wild,
+ CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(connect_in6addr_wild), 0,
+ "Allow connecting to the unspecified address for connect(2)");
+
int
in6_pcbsetport(struct in6_addr *laddr, struct inpcb *inp, struct ucred *cred)
{
@@ -351,7 +361,7 @@
if ((error = sa6_embedscope(sin6, V_ip6_use_defzone)) != 0)
return(error);
- if (!CK_STAILQ_EMPTY(&V_in6_ifaddrhead)) {
+ if (V_connect_in6addr_wild && !CK_STAILQ_EMPTY(&V_in6_ifaddrhead)) {
/*
* If the destination address is UNSPECIFIED addr,
* use the loopback addr, e.g ::1.
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 5, 4:17 PM (13 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14469812
Default Alt Text
D46259.diff (2 KB)
Attached To
Mode
D46259: netinet: Add a sysctl to allow disabling connections to INADDR_ANY
Attached
Detach File
Event Timeline
Log In to Comment