Developer Note Addendum
Revision 1.0b2
8/26/97
Single Link Multi-homing
Single Link Multi-homing System
Setup
Checking Open Transport
Version
InetInterfaceInfo Structure
Change
OTInetGetSecondaryAddress
Single Link Multi-homing
Open Transport v1.3 introduces Single Link Multi-homing, a mechanism by which Open Transport can support multiple IP addresses on the same hardware interface. This is useful for users like Internet Service Providers (ISPs), that want to give each of their clients, a distinct IP address, without requiring separate computers for each address.
This functionality is transparent to Open Transport clients which are not specifically interested in single link multi-homing. The following information will help TCP/IP server developers to implement single link multi-homing support into their products.
Single Link Multi-homing System Setup
Single Link Multi-homing support is only available with Open Transport v1.3. Your product will need to check that this version of Open Transport is present. You configure your system to use multiple IP addresses by 1. configuring the TCP/IP Control Panel for manual addressing, and 2. by creating a text file with the required name, "IP Secondary Addresses", and placing this file into the Preferences folder. Each line of the IP Secondary Addresses file contains a secondary IP address to be used by the system, and an optional subnet mask and router addrress for the secondary IP address. If there is no subnet mask entry, then a default subnet mask for the IP address class will be used. If there is no router address entry, then the default router associated with the primary address will be used.
Each secondary address entry must be prefixed by "ip=". Each subnet mask entry must be prefixed by "sm=". Each router address entry must be prefixed by "rt=". An example of the contents of the IP Secondary Addresses file follows.
; 'ip=' for ip address, 'sm=' subnet mask, 'rt=' router address
; Note: no space in 'ip=17.201.22.200'
;
; IP address Subnet Mask router addresses
;----------- ----------- ----------------
ip=17.201.22.200 sm=255.255.255.0 rt=17.201.20.1
ip=17.201.22.201 rt=17.201.20.1
ip=17.201.22.202
The order of the entries is important. The "rt=" entry must follow the "sm=" entry if used.
When Open Transport v1.3 activates TCP/IP, the primary address will be obtained from the TCP/IP Control Panel setting. Open Transport then looks for the IP Secondary Addresses file in the Preferences folder, to determine what other IP addresses, the system is to support. If there are duplicate IP address entries in the IP Secondary Addresses file, the duplicated addresses will be ignored. When Open Transport binds a TCP/IP connection, if there is an address conflict of the primary or any secondary addresses with another host system, Open Transport will raise an Alert with an error message to this problem.
Checking OpenTransport Version
To check the Open Transport version 1.3 is present, use the Gestalt function with the gestaltOpenTptVersions 'otvr' selector. Check that the result is greater or equal to kOTIPSingleLinkMultihomingVersion.
enum
{
kOTIPSingleLinkMultihomingVersion = 0x01300000 // OT 1.3
};
InetInterfaceInfo Structure Change
The OTGetInterfaceInfo function returns information about the local host. Under Open Transport v1.3, the InetInterfaceInfo structure is changed to allow the function to return additional information on supported secondary addresses. The new version of the structure is as follows
struct InetInterfaceInfo
{
InetHost fAddress;
InetHost fNetmask;
InetHost fBroadcastAddr;
InetHost fDefaultGatewayAddr;
InetHost fDNSAddr;
UInt16 fVersion;
UInt16 fHWAddrLen;
UInt8* fHWAddr;
UInt32 fIfMTU;
UInt8* fReservedPtrs[2];
InetDomainName fDomainName;
UInt32 fIPSecondaryCount; // returns number of IP
// secondary addresses
UInt8 fReserved[252];
};
You will pass in the new structure to the OTInetGetInterfaceInfo function. On return, the fIPSecondaryCount field returns the number of secondary IP addresses configured for the system. If there are secondary addresses, use the OTInetGetSecondaryAddresses function to obtain the additional addresses.
To distinguish this structure from earlier variants, the OTGetInterfaceInfo function sets the fVersion field to 3.
OTInetGetSecondaryAddresses
FUNCTION
OTInetGetSecondaryAddresses return active secondary IP addresses
C INTERFACE
- OSStatus OTInetGetSecondaryAddresses(InetHost* addr, UInt32* count, SInt32 index);
C++ INTERFACE
None. C++ clients use the C interface to this function.
Description
Parameters Before
Call
After
Call
addr
x (x)
count
(x) (x)
index
x /
OTInetGetSecondaryAddress is used to copy the supported secondary addresses associated with an IP interface . OTInetGetSecondaryAddress uses the index parameter to specify which IP interface to obtain secondary addresses for. For the primary IP interface, set index to kDefaultInterface which is zero. OTInetGetSecondaryAddress uses the count parameter to know how many secondary addresses to return in the addr buf. The addr buffer must be of size count * sizeof(InetAddr) to return all of the desired addresses. Use the fIPSecondaryCount field of the call to OTInetGetInterfaceInfo to determine the size of the buffer and as the count parameter to OTInetGetSecondaryAddresses. OTInetGetSecondaryAddresses modifies count to indicate the number of secondary addresses actually returned if less than the specified number of secondary addresses are returned.