在fedora12中,安装ipvsadm时遇到下列错误,通过排除找到了解决方案:

derector ipvsadm-1.25]# make
make -C libipvs
make[1]: Entering directory `/usr/local/src/ipvsadm-1.25/libipvs'
gcc -Wall -Wunused -Wstrict-prototypes -g -fPIC -DLIBIPVS_USE_NL -DHAVE_NET_IP_VS_H -c -o libipvs.o libipvs.c
In file included from libipvs.h:13,
from libipvs.c:23:
ip_vs.h:15:29: error: netlink/netlink.h: No such file or directory
ip_vs.h:16:31: error: netlink/genl/genl.h: No such file or directory
ip_vs.h:17:31: error: netlink/genl/ctrl.h: No such file or directory
In file included from libipvs.h:13,
from libipvs.c:23:
ip_vs.h:510: error: array type has incomplete element type
ip_vs.h:511: error: array type has incomplete element type
ip_vs.h:512: error: array type has incomplete element type
ip_vs.h:513: error: array type has incomplete element type
ip_vs.h:514: error: array type has incomplete element type
ip_vs.h:515: error: array type has incomplete element type
libipvs.c: In function ‘ipvs_nl_message’:
libipvs.c:48: warning: implicit declaration of function ‘nlmsg_alloc’
libipvs.c:48: warning: assignment makes pointer from integer without a cast
libipvs.c:52: warning: implicit declaration of function ‘genlmsg_put’
libipvs.c:52: error: ‘NL_AUTO_PID’ undeclared (first use in this function)
libipvs.c:52: error: (Each undeclared identifier is reported only once
libipvs.c:52: error: for each function it appears in.)
libipvs.c:52: error: ‘NL_AUTO_SEQ’ undeclared (first use in this function)
libipvs.c: In function ‘ipvs_nl_noop_cb’:
libipvs.c:60: error: ‘NL_OK’ undeclared (first use in this function)
libipvs.c:69: warning: implicit declaration of function ‘nlmsg_free’
libipvs.c:73: warning: implicit declaration of function ‘genl_connect’
libipvs.c:76: warning: implicit declaration of function ‘genl_ctrl_resolve’
libipvs.c:82: warning: implicit declaration of function ‘nl_handle_destroy’
libipvs.c:87: warning: implicit declaration of function ‘nl_socket_modify_cb’
libipvs.c:87: error: ‘NL_CB_VALID’ undeclared (first use in this function)
libipvs.c:87: error: ‘NL_CB_CUSTOM’ undeclared (first use in this function)
libipvs.c:87: error: ‘func’ undeclared (first use in this function)
libipvs.c:90: warning: implicit declaration of function ‘nl_send_auto_complete’
libipvs.c:93: warning: implicit declaration of function ‘nl_recvmsgs_default’
libipvs.c: In function ‘ipvs_init’:
libipvs.c:118: error: too many arguments to function ‘ipvs_nl_send_message’
libipvs.c: In function ‘ipvs_getinfo_parse_cb’:
libipvs.c:139: warning: implicit declaration of function ‘nlmsg_hdr’
libipvs.c:139: warning: initialization makes pointer from integer without a cast
libipvs.c:142: warning: implicit declaration of function ‘genlmsg_parse’
libipvs.c:149: warning: implicit declaration of function ‘nla_get_u32’
libipvs.c:152: error: ‘NL_OK’ undeclared (first use in this function)
libipvs.c:153: warning: control reaches end of non-void function
libipvs.c: In function ‘ipvs_getinfo’:
libipvs.c:166: error: too many arguments to function ‘ipvs_nl_send_message’
libipvs.c: In function ‘ipvs_flush’:
libipvs.c:189: error: too many arguments to function ‘ipvs_nl_send_message’
libipvs.c: In function ‘ipvs_nl_fill_service_attr’:
libipvs.c:205: warning: implicit declaration of function ‘nla_nest_start’
libipvs.c:205: warning: assignment makes pointer from integer without a cast
libipvs.c:209: warning: implicit declaration of function ‘NLA_PUT_U16’
libipvs.c:212: warning: implicit declaration of function ‘NLA_PUT_U32’
libipvs.c:215: warning: implicit declaration of function ‘NLA_PUT’
libipvs.c:219: warning: implicit declaration of function ‘NLA_PUT_STRING’
libipvs.c:224: warning: implicit declaration of function ‘nla_nest_end’
libipvs.c:227: warning: label ‘nla_put_failure’ defined but not used
libipvs.c: In function ‘ipvs_add_service’:
libipvs.c:243: error: too many arguments to function ‘ipvs_nl_send_message’
libipvs.c: In function ‘ipvs_update_service’:
libipvs.c:264: error: too many arguments to function ‘ipvs_nl_send_message’
libipvs.c: In function ‘ipvs_del_service’:
libipvs.c:284: error: too many arguments to function ‘ipvs_nl_send_message’
libipvs.c: In function ‘ipvs_zero_service’:
libipvs.c:309: error: too many arguments to function ‘ipvs_nl_send_message’
libipvs.c: In function ‘ipvs_nl_fill_dest_attr’:
libipvs.c:322: warning: assignment makes pointer from integer without a cast
libipvs.c:336: warning: label ‘nla_put_failure’ defined but not used
libipvs.c: In function ‘ipvs_add_dest’:
libipvs.c:354: error: too many arguments to function ‘ipvs_nl_send_message’
libipvs.c: In function ‘ipvs_update_dest’:
libipvs.c:384: error: too many arguments to function ‘ipvs_nl_send_message’
libipvs.c: In function ‘ipvs_del_dest’:
libipvs.c:413: error: too many arguments to function ‘ipvs_nl_send_message’
libipvs.c: In function ‘ipvs_set_timeout’:
libipvs.c:440: error: too many arguments to function ‘ipvs_nl_send_message’
libipvs.c:442: warning: label ‘nla_put_failure’ defined but not used
libipvs.c: In function ‘ipvs_start_daemon’:
libipvs.c:461: warning: assignment makes pointer from integer without a cast
libipvs.c:471: error: too many arguments to function ‘ipvs_nl_send_message’
libipvs.c: In function ‘ipvs_stop_daemon’:
libipvs.c:492: warning: assignment makes pointer from integer without a cast
libipvs.c:502: error: too many arguments to function ‘ipvs_nl_send_message’
libipvs.c: At top level:
libipvs.c:514: warning: ‘struct nlattr’ declared inside parameter list
libipvs.c: In function ‘ipvs_get_daemon’:
libipvs.c:1052: error: ‘NLM_F_DUMP’ undeclared (first use in this function)
libipvs.c:1053: error: too many arguments to function ‘ipvs_nl_send_message’
make[1]: *** [libipvs.o] Error 1
make[1]: Leaving directory `/usr/local/src/ipvsadm-1.25/libipvs'
make: *** [libs] Error 2


1.找到ip_vs.h文件.copy to /usr/include/net下

2.ln -s /usr/src/kernels/2.6.9-22.EL-i686/ /usr/src/linux

3.修改当前目录和libipvs目录中的Makefile的:
INCLUDE = -I/usr/src/linux/include -I.. -I.
为:
INCLUDE = -I/usr/src/kernels/2.6.9-22.EL-i686/include -I..