Need help to compile netlogin client

Kevin JR ultkevjr at yahoo.com
Sun Jul 20 02:53:29 UTC 2008


It must login first with a client before surf into Internet for me. The client can be compiled well under linux, however, it failed under freebsd due to the following code dealing with acquire ip/mac information:

[CODE]
static void getAddr(int sockfd, struct usrinfoSet *pui)
{
    struct ifreq addr;

    memset(&addr, 0x0, sizeof addr);
    strcpy(addr.ifr_name, pui -> dev);

    if (ioctl(sockfd, SIOCGIFADDR, (char *)&addr) == -1) {
        perror("ioctl");
        exit(EXIT_FAILURE);
    }

    strcpy(pui -> ip, inet_ntoa(((struct sockaddr_in *)&addr.ifr_addr) -> sin_addr));

    memset(&addr, 0, sizeof addr);
    strcpy(addr.ifr_name, (*pui).dev);

    if(ioctl(sockfd, SIOCGIFHWADDR, (char *)&addr) == -1) {
        perror("ioctl");
        exit(EXIT_FAILURE);
    }

    memcpy(pui -> mac, addr.ifr_hwaddr.sa_data, 0x6);
}
[/CODE]

The full source and client are attached.

Thanks in advance!




      


More information about the freebsd-questions mailing list