summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-09-26 11:31:14 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:20:21 -0500
commitc4ebedc7e19dcbc92061da4662b6c998d2c02bae (patch)
tree386cd0158e5189e1d95ffb381283a7e20fc08485 /source4/lib
parenta0c614ede22e629eea267b54d3b1852fe9cc2aad (diff)
downloadsamba-c4ebedc7e19dcbc92061da4662b6c998d2c02bae.tar.gz
samba-c4ebedc7e19dcbc92061da4662b6c998d2c02bae.tar.bz2
samba-c4ebedc7e19dcbc92061da4662b6c998d2c02bae.zip
r18917: having 255 virtual interfaces available in socket wrapper means we
stat() 240 files that don't exist on every broadcast. That's a bit excessive! reduce max virtual interfaces to 16 (This used to be commit 3c4100027c7d3806a2021cb4d70ec6adf9dd2dc6)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/socket_wrapper/socket_wrapper.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/source4/lib/socket_wrapper/socket_wrapper.c b/source4/lib/socket_wrapper/socket_wrapper.c
index 331e23aa48..6c23cebc81 100644
--- a/source4/lib/socket_wrapper/socket_wrapper.c
+++ b/source4/lib/socket_wrapper/socket_wrapper.c
@@ -89,6 +89,8 @@
#define SOCKET_TYPE_CHAR_TCP 'T'
#define SOCKET_TYPE_CHAR_UDP 'U'
+#define MAX_WRAPPED_INTERFACES 16
+
static struct sockaddr *sockaddr_dup(const void *data, socklen_t len)
{
struct sockaddr *ret = (struct sockaddr *)malloc(len);
@@ -156,7 +158,7 @@ static unsigned int socket_wrapper_default_iface(void)
if (s) {
unsigned int iface;
if (sscanf(s, "%u", &iface) == 1) {
- if (iface >= 1 && iface <= 0xFF) {
+ if (iface >= 1 && iface <= MAX_WRAPPED_INTERFACES) {
return iface;
}
}
@@ -189,7 +191,7 @@ static int convert_un_in(const struct sockaddr_un *un, struct sockaddr_in *in, s
return -1;
}
- if (iface == 0 || iface > 0xFF) {
+ if (iface == 0 || iface > MAX_WRAPPED_INTERFACES) {
errno = EINVAL;
return -1;
}
@@ -804,7 +806,7 @@ _PUBLIC_ ssize_t swrap_sendto(int s, const void *buf, size_t len, int flags, con
type = SOCKET_TYPE_CHAR_UDP;
- for(iface=0; iface <= 0xFF; iface++) {
+ for(iface=0; iface <= MAX_WRAPPED_INTERFACES; iface++) {
snprintf(un_addr.sun_path, sizeof(un_addr.sun_path), "%s/"SOCKET_FORMAT,
socket_wrapper_dir(), type, iface, prt);
if (stat(un_addr.sun_path, &st) != 0) continue;