当前位置: 技术问答>linux和unix
我想找ifconfig的源代码,谢谢!
来源: 互联网 发布时间:2015-06-11
本文导语: 急需,我手头没有Linux系统,无法从rpm包里安装,请贴出源文件好么?谢谢! | #include #include #include #include #include #include #include #include #include #define ETH_NAME "eth0" int main() { int so...
急需,我手头没有Linux系统,无法从rpm包里安装,请贴出源文件好么?谢谢!
|
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define ETH_NAME "eth0"
int main()
{
int sock;
struct sockaddr_in sin;
struct sockaddr sa;
struct ifreq ifr;
unsigned char mac[6];
sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock == -1)
{
perror("socket");
return -1;
}
strncpy(ifr.ifr_name, ETH_NAME, IFNAMSIZ);
ifr.ifr_name[IFNAMSIZ - 1] = 0;
if (ioctl(sock, SIOCGIFADDR, &ifr)
#include
#include
#include
#include
#include
#include
#include
#include
#define ETH_NAME "eth0"
int main()
{
int sock;
struct sockaddr_in sin;
struct sockaddr sa;
struct ifreq ifr;
unsigned char mac[6];
sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock == -1)
{
perror("socket");
return -1;
}
strncpy(ifr.ifr_name, ETH_NAME, IFNAMSIZ);
ifr.ifr_name[IFNAMSIZ - 1] = 0;
if (ioctl(sock, SIOCGIFADDR, &ifr)