Skip to content

Commit

Permalink
fix header-#include and stop-lan LCS port-serialization issues affect…
Browse files Browse the repository at this point in the history
…ing tuntap set MAC addr et. al

git-svn-id: file:///home/jj/hercules.svn/trunk@3873 956126f8-22a0-4046-8f4a-272fa8102e63
  • Loading branch information
Fish (David B Trout) committed May 6, 2006
1 parent 9e3f544 commit 6b53b97
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
10 changes: 10 additions & 0 deletions ctc_lcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,7 @@ static void LCS_StartLan( PLCSDEV pLCSDEV, PLCSHDR pHeader )

#endif /* defined( TUNTAP_IFF_RUNNING_NEEDED ) */

// Enable the interface by turning on the IFF_UP flag...
VERIFY( TUNTAP_SetFlags( pPort->szNetDevName, nIFFlags ) == 0 );

#ifdef OPTION_TUNTAP_DELADD_ROUTES
Expand Down Expand Up @@ -1167,10 +1168,17 @@ static void LCS_StopLan( PLCSDEV pLCSDEV, PLCSHDR pHeader )

pPort = &pLCSDEV->pLCSBLK->Port[pLCSDEV->bPort];

// Serialize access to eliminate ioctl errors
obtain_lock( &pPort->Lock );

obtain_lock( &pPort->EventLock );
pPort->fStarted = 0;
signal_condition( &pPort->Event );
release_lock( &pPort->EventLock );
usleep( 250*1000 );

// Disable the interface by turning off the IFF_UP flag...
VERIFY( TUNTAP_SetFlags( pPort->szNetDevName, 0 ) == 0 );

#ifdef OPTION_TUNTAP_DELADD_ROUTES

Expand Down Expand Up @@ -1202,6 +1210,8 @@ static void LCS_StopLan( PLCSDEV pLCSDEV, PLCSHDR pHeader )
}
#endif

release_lock( &pPort->Lock );

// FIXME: Really need to iterate through the devices and close
// the TAP interface if all devices have been stopped.

Expand Down
8 changes: 6 additions & 2 deletions hercules.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@

#include "hstdinc.h" // Precompilation-eligible header files

#if defined(HAVE_GETOPT_LONG) && !defined(__GETOPT_H__)
#include <getopt.h>
#ifdef _MSVC_
#include "getopt.h"
#else
#if defined(HAVE_GETOPT_LONG) && !defined(__GETOPT_H__)
#include <getopt.h>
#endif
#endif

#ifdef OPTION_DYNAMIC_LOAD
Expand Down
2 changes: 1 addition & 1 deletion hercwind.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ typedef int mode_t;
#undef NO_ATTR_REGPARM // ( ATTR_REGPARM(x) == __fastcall )
#define HAVE_ATTR_REGPARM // ( ATTR_REGPARM(x) == __fastcall )

#include "getopt.h"
//#include "getopt.h"
#define HAVE_GETOPT_LONG

#include <math.h>
Expand Down
2 changes: 2 additions & 0 deletions hostopts.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
#ifndef _HOSTOPTS_H
#define _HOSTOPTS_H

#include "hercwind.h" // (need HAVE_DECL_SIOCSIFHWADDR, etc)

/*-------------------------------------------------------------------*/
/* ZZ FIXME
'OPTION_SCSI_ERASE_TAPE'
Expand Down

0 comments on commit 6b53b97

Please sign in to comment.