BUG: Setsockopt with IP_MULTICAST_IF Works for Invalid Address

ID: Q196351


The information in this article applies to:
  • Microsoft Win32 Software Development Kit (SDK), used with:
    • Microsoft Windows NT 4.0
    • Microsoft Windows 2000


SYMPTOMS

The IP_MULTICAST_IF option and an IP address are passed to the setsockopt() API to specify which interface should be used for outgoing multicast packets. If you attempt to set this option to an invalid IP address, the function does not return an error.

This occurs only if setsockopt is called before bind. Once the socket is bound to a local interface, if you attempt to set the multicast interface to an invalid address, it fails.


CAUSE

Winsock itself does not recognize addresses. The TCP/IP stack does not validate the address supplied until a call to bind is made. Although setsockopt with invalid IP address succeeds, the subsequent bind fails.


RESOLUTION

Ensure that the interface supplied to setsockopt is valid. Use the Winsock ioctl command SIO_GET_INTERFACE_LIST to obtain a list of valid interface addresses.

NOTE: This ioctl is only available in Winsock 2.


STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.

Additional query words: multicast IP

Keywords : kbnetwork kbAPI kbNTOS400bug kbWinOS2000bug kbSDKPlatform kbWinsock kbGrpNet
Version : WINDOWS:
Platform : WINDOWS
Issue type : kbbug


Last Reviewed: February 3, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.