- 论坛徽章:
- 0
|
我用sysctl()函数操作路由表,部分代码如下:
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <linux/unistd.h>
#include <linux/types.h>
#include <linux/sysctl.h>
#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <net/if.h>
#include <net/route.h>
mib[0] = CTL_NET;
mib[1] = AF_ROUTE;
mib[2] = 0;
mib[3] = 0; /*AF_INET;*/
mib[4] = NET_RT_DUMP;
mib[5] = 0;
/* get interface data */
if (sysctl(mib, 6, NULL, needed, NULL, 0) == -1)
printf("sysctl error!\n");
编译时在粗斜体部分,老师出现如下错误:
NET_RT_DUMP?undeclared (first use in this function)
(Each undeclared identifier is reported only once
for each function it appears in.)
请问为什么? |
|