Jinmei

For X/Open Networking Interfaces, you need to link with libxnet..

% cc -o foo -D_XOPEN_SOURCE_EXTENDED -lxnet foo.c

Vijay

JINMEI Tatuya wrote:

I recently noticed the IPV6_RECVPKTINFO socket option (defined in
RFC3542) doesn't work on HP-UX 11.11 (more specifically, uname -a says
the version is "B.11.11 U 9000/785 2016020223").

I've compiled the source code attached below by the following command:
% cc -o foo -D_XOPEN_SOURCE_EXTENDED foo.c
(HP-UX needs _XOPEN_SOURCE_EXTENDED to enable the cmsg framework)

I then ran the compiled program and sent a UDP packet to the socket
the program opened.  According to the output, it received the packet,
but didn't return pktinfo as an ancillary data item:
received 27-byte data, 0-byte cmsg

Is this a bug of the HP-UX kernel, or is there any clue for this
(e.g. additional socket option, etc)?

                                        JINMEI, Tatuya
                                        Communication Platform Lab.
                                        Corporate R&D Center, Toshiba Corp.
                                        [EMAIL PROTECTED]

#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>

#include <netinet/in.h>

#include <netdb.h>
#include <stdio.h>
#include <string.h>

main()
{
        char cmsgbuf[1024], recvbuf[1024];
        struct addrinfo hints, *res;
        struct msghdr msg;
        struct iovec iov[1];
        int on, s, cc;

        memset(&hints, 0, sizeof(hints));
        hints.ai_family = AF_INET6;
        hints.ai_socktype = SOCK_DGRAM;
        hints.ai_flags = AI_PASSIVE;

getaddrinfo(NULL, "30053", &hints, &res); /* port # doesn't matter */

s = socket(res->ai_family, res->ai_socktype, res->ai_protocol);

        on = 1;
        setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on, sizeof(on));

bind(s, res->ai_addr, res->ai_addrlen);

        memset(&msg, 0, sizeof(msg));
        msg.msg_controllen = sizeof(cmsgbuf);
        msg.msg_control = cmsgbuf;
        iov[0].iov_base = recvbuf;
        iov[0].iov_len = sizeof(recvbuf);
        msg.msg_iov = iov;
        msg.msg_iovlen = 1;

        cc = recvmsg(s, &msg, 0);
        printf("received %d-byte data, %d-byte cmsg\n",
            cc, msg.msg_controllen);

        exit(0);
}
---------------------------------------------------------------------
The IPv6 Users Mailing List
Unsubscribe by sending "unsubscribe users" to [EMAIL PROTECTED]






--
__________________________________________________________
Vijayabhaskar A K            Phone : +91-80-2053085
Hewlett Packard              Mobile: +91-9845241382
Bangalore, India             Email : [EMAIL PROTECTED]

Intellectuals solve problems: geniuses prevent them.
-Albert Einstein, physicist, Nobel laureate (1879-1955)
__________________________________________________________


--------------------------------------------------------------------- The IPv6 Users Mailing List Unsubscribe by sending "unsubscribe users" to [EMAIL PROTECTED]

Reply via email to