added a dest_port parameter to send_mailslot() so we send replies to
authorAndrew Tridgell <tridge@samba.org>
Sun, 30 Aug 1998 17:04:24 +0000 (17:04 +0000)
committerAndrew Tridgell <tridge@samba.org>
Sun, 30 Aug 1998 17:04:24 +0000 (17:04 +0000)
the correct port in environments like ip masq.

source/include/proto.h
source/nmbd/nmbd_browsesync.c
source/nmbd/nmbd_elections.c
source/nmbd/nmbd_incomingdgrams.c
source/nmbd/nmbd_packets.c
source/nmbd/nmbd_processlogon.c
source/nmbd/nmbd_sendannounce.c

index 784d130d23ea483cb5aaaf9d11ba6100fe7b536d..ae38ece1a26f09da0d3730701feeb5420923e123 100644 (file)
@@ -782,7 +782,8 @@ BOOL listen_for_packets(BOOL run_election);
 BOOL send_mailslot(BOOL unique, char *mailslot,char *buf,int len,
                    char *srcname, int src_type,
                    char *dstname, int dest_type,
-                   struct in_addr dest_ip,struct in_addr src_ip);
+                   struct in_addr dest_ip,struct in_addr src_ip,
+                  int dest_port);
 
 /*The following definitions come from  nmbd/nmbd_processlogon.c  */
 
index a4faca55152c5d56f969f37e48590ef7a7e5317b..8136568c6aa88fefbea897ed796f55823f858bbd 100644 (file)
@@ -122,7 +122,8 @@ Do not announce to ourselves.\n", work->work_group ));
 to %s for workgroup %s.\n", namestr(&work->dmb_name), work->work_group ));
 
   send_mailslot(True, BROWSE_MAILSLOT, outbuf,PTR_DIFF(p,outbuf),
-          global_myname, 0x0, work->dmb_name.name, 0x0, work->dmb_addr, FIRST_SUBNET->myip);
+               global_myname, 0x0, work->dmb_name.name, 0x0, 
+               work->dmb_addr, FIRST_SUBNET->myip, DGRAM_PORT);
 
 }
 
index 5c85191ec2c3ce9a55d5a826e6302e443416d0f2..cd310639e94ff1b5fb6feb6aa2b8ae2961cdb66f 100644 (file)
@@ -62,7 +62,7 @@ static void send_election_dgram(struct subnet_record *subrec, char *workgroup_na
   send_mailslot(False, BROWSE_MAILSLOT, outbuf, PTR_DIFF(p,outbuf),
                 global_myname, 0,
                 workgroup_name, 0x1e,
-                subrec->bcast_ip, subrec->myip);
+                subrec->bcast_ip, subrec->myip, DGRAM_PORT);
 }
 
 /*******************************************************************
index daa321b3ae900e35a4523cc32ec3020859b68c08..36242d9ac2c8663ec13d33734c72291460b9b5b7 100644 (file)
@@ -536,12 +536,12 @@ originate from OS/2 Warp client. Ignoring packet.\n"));
 /****************************************************************************
   Send a backup list response.
 *****************************************************************************/
-
 static void send_backup_list_response(struct subnet_record *subrec, 
-                             struct work_record *work,
-                             struct nmb_name *send_to_name,
-                             unsigned char max_number_requested,
-                            uint32 token, struct in_addr sendto_ip)
+                                     struct work_record *work,
+                                     struct nmb_name *send_to_name,
+                                     unsigned char max_number_requested,
+                                     uint32 token, struct in_addr sendto_ip,
+                                     int port)
 {                     
   char outbuf[1024];
   char *p, *countptr, *nameptr;
@@ -610,7 +610,7 @@ static void send_backup_list_response(struct subnet_record *subrec,
                 outbuf,PTR_DIFF(p,outbuf),
                 global_myname, 0, 
                 send_to_name->name,0,
-                sendto_ip, subrec->myip);
+                sendto_ip, subrec->myip, port);
 }
 
 /*******************************************************************
@@ -687,7 +687,7 @@ and I am not a local master browser.\n", workgroup_name));
   }
 
   send_backup_list_response(subrec, work, &dgram->source_name, 
-                            max_number_requested, token, p->ip);
+                            max_number_requested, token, p->ip, p->port);
 }
 
 /*******************************************************************
index 65d98c9a5964ff7a6ed06115ff045223d7f0791b..816695833ac34b1c30e7c56a41cb0d14805a1bcc 100644 (file)
@@ -1875,13 +1875,12 @@ BOOL listen_for_packets(BOOL run_election)
 
 /****************************************************************************
   Construct and send a netbios DGRAM.
-  Note that this currently sends all packets to port 138.
 **************************************************************************/
-
 BOOL send_mailslot(BOOL unique, char *mailslot,char *buf,int len,
                    char *srcname, int src_type,
                    char *dstname, int dest_type,
-                   struct in_addr dest_ip,struct in_addr src_ip)
+                   struct in_addr dest_ip,struct in_addr src_ip,
+                  int dest_port)
 {
   BOOL loopback_this_packet = False;
   struct packet_struct p;
@@ -1936,7 +1935,7 @@ BOOL send_mailslot(BOOL unique, char *mailslot,char *buf,int len,
   dgram->datasize = PTR_DIFF(p2,ptr+4); /* +4 for tcp length. */
 
   p.ip = dest_ip;
-  p.port = DGRAM_PORT;
+  p.port = dest_port;
   p.fd = find_subnet_mailslot_fd_for_address( src_ip );
   p.timestamp = time(NULL);
   p.packet_type = DGRAM_PACKET;
index 2ad4a831ca85d18a96b68439cdbbc32413e8de47..29dc68fb800503972dcf45c0e7f3970a7214c880 100644 (file)
@@ -112,7 +112,7 @@ logons are not enabled.\n", inet_ntoa(p->ip) ));
                     dgram->dest_name.name_type,
                     dgram->source_name.name,
                     dgram->source_name.name_type,
-                    p->ip, *iface_ip(p->ip));  
+                    p->ip, *iface_ip(p->ip), p->port);  
       break;
     }
 
@@ -167,7 +167,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
                   dgram->dest_name.name_type,
                   dgram->source_name.name,
                   dgram->source_name.name_type,
-                  p->ip, *iface_ip(p->ip));  
+                  p->ip, *iface_ip(p->ip), p->port);  
       return;
     }
 
@@ -243,7 +243,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
                    dgram->dest_name.name_type,
                    dgram->source_name.name,
                    dgram->source_name.name_type,
-                   p->ip, *iface_ip(p->ip));  
+                   p->ip, *iface_ip(p->ip), p->port);  
       break;
     }
 
index 6c9f67ab2101f34c42798693c2d4db606d0c0713..d43d2878e3e5e5677efbcc115d8e9ae7c24299e4 100644 (file)
@@ -54,7 +54,8 @@ void send_browser_reset(int reset_type, char *to_name, int to_type, struct in_ad
   p++;
 
   send_mailslot(True, BROWSE_MAILSLOT, outbuf,PTR_DIFF(p,outbuf),
-                global_myname, 0x0, to_name, to_type, to_ip, FIRST_SUBNET->myip);
+                global_myname, 0x0, to_name, to_type, to_ip, 
+               FIRST_SUBNET->myip, DGRAM_PORT);
 }
 
 /****************************************************************************
@@ -84,7 +85,8 @@ to subnet %s\n", work->work_group, subrec->subnet_name));
   p = skip_string(p,1);
   
   send_mailslot(False, BROWSE_MAILSLOT, outbuf,PTR_DIFF(p,outbuf),
-                global_myname, 0x0, work->work_group,0x1e, subrec->bcast_ip, subrec->myip);
+                global_myname, 0x0, work->work_group,0x1e, subrec->bcast_ip, 
+               subrec->myip, DGRAM_PORT);
 }
 
 /****************************************************************************
@@ -124,7 +126,8 @@ static void send_announcement(struct subnet_record *subrec, int announce_type,
   p = skip_string(p,1);
 
   send_mailslot(False,BROWSE_MAILSLOT, outbuf, PTR_DIFF(p,outbuf),
-                from_name, 0x0, to_name, to_type, to_ip, subrec->myip);
+                from_name, 0x0, to_name, to_type, to_ip, subrec->myip,
+               DGRAM_PORT);
 }
 
 /****************************************************************************
@@ -155,7 +158,8 @@ static void send_lm_announcement(struct subnet_record *subrec, int announce_type
   p = skip_string(p,1);
 
   send_mailslot(False,LANMAN_MAILSLOT, outbuf, PTR_DIFF(p,outbuf),
-                from_name, 0x0, to_name, to_type, to_ip, subrec->myip);
+                from_name, 0x0, to_name, to_type, to_ip, subrec->myip,
+               DGRAM_PORT);
 }
 
 /****************************************************************************
@@ -601,6 +605,6 @@ for workgroup %s on subnet %s.\n", global_myworkgroup, FIRST_SUBNET->subnet_name
                  global_myname, inet_ntoa(addr) ));
 
     send_mailslot(True, BROWSE_MAILSLOT, outbuf,PTR_DIFF(p,outbuf),
-          global_myname, 0x0, "*", 0x0, addr, FIRST_SUBNET->myip);
+          global_myname, 0x0, "*", 0x0, addr, FIRST_SUBNET->myip, DGRAM_PORT);
   }
 }