]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
After talking with Andrew added "interfaces only" parameter that
authorJeremy Allison <jra@samba.org>
Sat, 18 Oct 1997 00:22:04 +0000 (00:22 +0000)
committerJeremy Allison <jra@samba.org>
Sat, 18 Oct 1997 00:22:04 +0000 (00:22 +0000)
turns off the filtering on the broadcast socket by default.
Jeremy (jallison@whistle.com)

source/include/proto.h
source/namepacket.c
source/param/loadparm.c

index fa689d1c90f24c7a508201a3b092d08f1c705451..e0ddee894398e72fcdd0583ef546629c655ad92a 100644 (file)
@@ -185,6 +185,7 @@ BOOL lp_browse_list(void);
 BOOL lp_unix_realname(void);
 BOOL lp_nis_home_map(void);
 BOOL lp_time_server(void);
+BOOL lp_interfaces_only(void);
 int lp_os_level(void);
 int lp_max_ttl(void);
 int lp_max_log_size(void);
index 55c850f25443dc6748c7b71f42074970dbe0c0b4..ba1c4044a3b2295485e22c1d7754141630046060 100644 (file)
@@ -622,18 +622,12 @@ BOOL listen_for_packets(BOOL run_election)
           struct packet_struct *packet = read_packet(sock_array[i], NMB_PACKET);
           if (packet)
           {
-
             /*
-             * If we got a packet on the broadcast socket check it
-             * came from one of our local nets. We should only be
-             * receiving broadcasts from nets we have subnets for.
-             *
-             * Note that this filter precludes remote announces.
-             * If we need this to work we will have to add an
-             * 'allow local announce' parameter that gives a
-             * list of networks we will allow through the filter.
+             * If we got a packet on the broadcast socket and interfaces
+             * only is set then check it came from one of our local nets. 
              */
-            if((sock_array[i] == ClientNMB) && (!is_local_net(packet->ip)))
+            if(lp_interfaces_only() && (sock_array[i] == ClientNMB) && 
+               (!is_local_net(packet->ip)))
             {
               DEBUG(7,("discarding nmb packet sent to broadcast socket from %s:%d\n",
                         inet_ntoa(packet->ip),packet->port));    
@@ -663,16 +657,11 @@ BOOL listen_for_packets(BOOL run_election)
           if (packet)
           {
             /*
-             * If we got a packet on the broadcast socket check it
-             * came from one of our local nets. We should only be
-             * receiving broadcasts from nets we have subnets for.
-             *
-             * Note that this filter precludes remote announces.
-             * If we need this to work we will have to add an
-             * 'allow local announce' parameter that gives a
-             * list of networks we will allow through the filter.
+             * If we got a packet on the broadcast socket and interfaces
+             * only is set then check it came from one of our local nets. 
              */
-            if((sock_array[i] == ClientDGRAM) && (!is_local_net(packet->ip)))
+            if(lp_interfaces_only() && (sock_array[i] == ClientDGRAM) && 
+                 (!is_local_net(packet->ip)))
             {
               DEBUG(7,("discarding dgram packet sent to broadcast socket from %s:%d\n",
                         inet_ntoa(packet->ip),packet->port));    
index b87765007816ee9a79f679c7d145ac5f7c22cad9..1568e3abf51679f121b41df1512c2b3a1dd6931e 100644 (file)
@@ -183,6 +183,7 @@ typedef struct
   BOOL bUnixRealname;
   BOOL bNISHomeMap;
   BOOL bTimeServer;
+  BOOL bInterfacesOnly;
 } global;
 
 static global Globals;
@@ -410,6 +411,7 @@ struct parm_struct
   {"null passwords",   P_BOOL,    P_GLOBAL, &Globals.bNullPasswords,    NULL},
   {"strip dot",        P_BOOL,    P_GLOBAL, &Globals.bStripDot,         NULL},
   {"interfaces",       P_STRING,  P_GLOBAL, &Globals.szInterfaces,      NULL},
+  {"interfaces only",  P_BOOL,    P_GLOBAL, &Globals.bInterfacesOnly,   NULL},
   {"password server",  P_STRING,  P_GLOBAL, &Globals.szPasswordServer,  NULL},
   {"socket options",   P_GSTRING, P_GLOBAL, user_socket_options,        NULL},
   {"netbios name",     P_UGSTRING,P_GLOBAL, myname,                     NULL},
@@ -655,6 +657,7 @@ static void init_globals(void)
   coding_system = interpret_coding_system (KANJI, SJIS_CODE);
   Globals.client_code_page = DEFAULT_CLIENT_CODE_PAGE;
   Globals.bTimeServer = False;
+  Globals.bInterfacesOnly = False;
 
 /* these parameters are set to defaults that are more appropriate
    for the increasing samba install base:
@@ -867,6 +870,7 @@ FN_GLOBAL_BOOL(lp_browse_list,&Globals.bBrowseList)
 FN_GLOBAL_BOOL(lp_unix_realname,&Globals.bUnixRealname)
 FN_GLOBAL_BOOL(lp_nis_home_map,&Globals.bNISHomeMap)
 FN_GLOBAL_BOOL(lp_time_server,&Globals.bTimeServer)
+FN_GLOBAL_BOOL(lp_interfaces_only,&Globals.bInterfacesOnly)
 
 FN_GLOBAL_INTEGER(lp_os_level,&Globals.os_level)
 FN_GLOBAL_INTEGER(lp_max_ttl,&Globals.max_ttl)