SOCKET sock;
char options[8];
setsockopt(sock, IPPROTO_IP, IP_OPTIONS, options, sizeof(options));
However, having invoked the above setsockopt, no other socket related
function succeeds, all failing with code 10022 (invalid parameter).
If one performs a "bind" before attempting the above "setsockopt", the
"bind" succeeds, and then the "setsockopt" fails with 10022.
The functionality of setting the data to send in the IP packet header
works just fine under Solaris and Linux, but apparently not under any
flavor of Windows.
Any workarounds?
Thanks.
Keep in mind that according to
http://msdn.microsoft.com/library/en-us/winsock/winsock/ipproto_ip_socket_options.asp
support for this is not required.
> However, having invoked the above setsockopt, no other socket related
> function succeeds, all failing with code 10022 (invalid parameter).
>
> If one performs a "bind" before attempting the above "setsockopt", the
> "bind" succeeds, and then the "setsockopt" fails with 10022.
What options do you set there?
> The functionality of setting the data to send in the IP packet header
> works just fine under Solaris and Linux, but apparently not under any
> flavor of Windows.
>
> Any workarounds?
Maybe this will help
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q257460
--
Eugene
www.gershnik.com
This code:
struct
{
unsigned char oCode;
unsigned char oLen;
unsigned char oOffset;
unsigned long oAddrs[9];
} xIpOption2;
ZeroMemory ( &xIpOption2, sizeof xIpOption2 );
xIpOption2.oCode = 0x07;
xIpOption2.oLen = 39;
xIpOption2.oOffset = 4;
xRet = setsockopt ( xSock, IPPROTO_IP, IP_OPTIONS,
(char*)&xIpOption2, xIpOption2.oLen );
if ( xRet == SOCKET_ERROR )
{
ReportWSErrorNoExit ( "sso:IP_OPTIONS SOCKET_ERROR" );
}
produced this packet:
Network Monitor trace Mon 04/25/05 11:38:54 Captur 1.txt
Frame Time Src MAC Addr Dst MAC Addr Protocol
Description Src Other Addr Dst Other Addr Type Other
Addr
5 13.624023 LOCAL router UDP Src
Port: Unknown, (1480); Dst Port: Unknown (999 gimlet 192.0.2.99
+ Frame: Base frame properties
+ ETHERNET: ETYPE = 0x0800 : Protocol = IP: DOD Internet Protocol
IP: ID = 0x32BC; Proto = UDP; Len: 128
IP: Version = 4 (0x4)
IP: Header Length = 60 (0x3C)
IP: Precedence = Routine
IP: Type of Service = Normal Service
IP: Total Length = 128 (0x80)
IP: Identification = 12988 (0x32BC)
+ IP: Flags Summary = 0 (0x0)
IP: Fragment Offset = 0 (0x0) bytes
IP: Time to Live = 128 (0x80)
IP: Protocol = UDP - User Datagram
IP: Checksum = 0x6E1A
IP: Source Address = 192.168.1.100
IP: Destination Address = 192.0.2.99
IP: Option Fields
IP: Record Route Option
IP: Option Type = Record Route
IP: Option Length = 39 (0x27)
IP: Next Slot Pointer = 4 (0x4)
IP: Route Traveled
IP: Gateway = 0.0.0.0
IP: Gateway = 0.0.0.0
IP: Gateway = 0.0.0.0
IP: Gateway = 0.0.0.0
IP: Gateway = 0.0.0.0
IP: Gateway = 0.0.0.0
IP: Gateway = 0.0.0.0
IP: Gateway = 0.0.0.0
IP: Gateway = 0.0.0.0
IP: End of Options = 0 (0x0)
IP: Data: Number of data bytes remaining = 68 (0x0044)
+ UDP: Src Port: Unknown, (1480); Dst Port: Unknown (9999); Length =
68 (0x44)
The error-ing behaviour has apparently changed somewhat from 2000 to XP
though. For an apparenly unacceptable Option array, XP gives 10022 on
the setsocktopt, whereas 2000 errored only on the sendto.
>> If one performs a "bind" before attempting the above "setsockopt",
>> the "bind" succeeds, and then the "setsockopt" fails with 10022.
>>
> What options do you set there?
>
>> The functionality of setting the data to send in the IP packet header
>> works just fine under Solaris and Linux, but apparently not under any
>> flavor of Windows.
>>
>> Any workarounds?
>>
> Maybe this will help
> http://support.microsoft.com/default.aspx?scid=kb;en-us;Q257460
>
--
Alan J. McFarlane
http://www.alanjmcf.me.uk/
Please follow-up in the newsgroup for the benefit of all.
Thanks for your time.