[OpenAFS-devel] Windows client: auto-select of Loopback lana
Scott D. Williams
sdw@email.unc.edu
Fri, 22 Nov 2002 13:47:19 -0500
This will enable the windows client to auto-select the Windows Loopback
Adapter lana, if present. One caveat: it uses the default mac address
of the loopback adapter -- I have not seen any instance where it differs,
nor any method for changing it. Please advise if I've missed something.
The corresponding service binary is available here for testing purposes:
http://www.unc.edu/~sdw/afsd_service_wla.exe
--Scott
--- orig/src/WINNT/afsd/smb.c 2002-07-26 01:14:26.000000000 -0400
+++ update/src/WINNT/afsd/smb.c 2002-11-22 10:59:29.000000000 -0500
@@ -6050,6 +6050,24 @@
int len;
int lana_found = 0;
+ /*******************************************************************/
+ /* ms loopback adapter scan
+ /*******************************************************************/
+ struct
+ {
+ ADAPTER_STATUS status;
+ NAME_BUFFER NameBuff [30];
+ } Adapter;
+
+ int j;
+ BOOL wla_found;
+
+ /* AFAIK, this is the default for the ms loopback adapter.*/
+ unsigned char kWLA_MAC[6] = { 0x02, 0x00, 0x4c, 0x4f, 0x4f, 0x50 };
+ /*******************************************************************/
+
+
+
/* setup the NCB system */
ncbp = GetNCB();
#ifdef DJGPP
@@ -6091,6 +6109,34 @@
else {
sprintf(s, "Netbios NCBRESET lana %d succeeded",
lana_list.lana[i]);
afsi_log(s);
+
+
/*******************************************************************/
+ /* check to see if this is the "Microsoft Loopback
Adapter" */
+
/*******************************************************************/
+ memset( ncbp, 0, sizeof (*ncbp) );
+ ncbp->ncb_command = NCBASTAT;
+ ncbp->ncb_lana_num = lana_list.lana[i];
+ strcpy( ncbp->ncb_callname, "* " );
+ ncbp->ncb_buffer = (char *) &Adapter;
+ ncbp->ncb_length = sizeof(Adapter);
+ code = Netbios( ncbp );
+
+ if ( code == 0 ) {
+ wla_found = TRUE;
+ for (j=0; wla_found && (j<6); j++)
+ wla_found = (
Adapter.status.adapter_address[j] == kWLA_MAC[j] );
+
+ if ( wla_found ) {
+ sprintf(s, "Windows Loopback
Adapter detected lana %d", lana_list.lana[i]);
+ afsi_log(s);
+
+ /* select this lana; no need to
continue */
+ lana_list.length = 1;
+ lana_list.lana[0] = lana_list.lana[i];
+ break;
+ }
+ }
+
/*******************************************************************/
}
}
#else