|
close(s); /* Thanks Rob. for noticing this */
if (err == -1)
return err;
memcpy(addr, req.ifr_hwaddr.sa_data,8);
return 0;
}
/*
* Obtain the maximum packet size on an interface.
*
* Return:
* >0 Return is the mtu of the interface
* -1 Error.
*/
int
GetDeviceMTU(char *device)
{
int s = socket(AF_INET, SOCK_DGRAM, 0);
struct ifreq req;
int err;
strcpy(req.ifr_name, device);
err = ioctl(s, SIOCGIFMTU, &req);
页码:[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] 第9页、共11页 |