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!




      
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to