Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
f083ff82
L
libvirt
项目概览
openeuler
/
libvirt
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libvirt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f083ff82
编写于
8月 11, 2013
作者:
R
Roman Bogorodskiy
提交者:
Eric Blake
8月 21, 2013
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bridge driver: implement networkEnableIpForwarding for BSD
Implement networkEnableIpForwarding() using BSD style sysctl.
上级
3f0d2ee9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
17 addition
and
3 deletion
+17
-3
configure.ac
configure.ac
+4
-3
src/network/bridge_driver.c
src/network/bridge_driver.c
+13
-0
未找到文件。
configure.ac
浏览文件 @
f083ff82
...
...
@@ -207,7 +207,8 @@ dnl Availability of various common functions (non-fatal if missing),
dnl and various less common threadsafe functions
AC_CHECK_FUNCS_ONCE([cfmakeraw geteuid getgid getgrnam_r getmntent_r \
getpwuid_r getuid kill mmap newlocale posix_fallocate posix_memalign \
prlimit regexec sched_getaffinity setgroups setns setrlimit symlink])
prlimit regexec sched_getaffinity setgroups setns setrlimit symlink \
sysctlbyname])
dnl Availability of pthread functions (if missing, win32 threading is
dnl assumed). Because of $LIB_PTHREAD, we cannot use AC_CHECK_FUNCS_ONCE.
...
...
@@ -220,8 +221,8 @@ LIBS=$old_libs
dnl Availability of various common headers (non-fatal if missing).
AC_CHECK_HEADERS([pwd.h paths.h regex.h sys/un.h \
sys/poll.h syslog.h mntent.h net/ethernet.h linux/magic.h \
sys/un.h sys/syscall.h
netinet/tcp.h ifaddrs.h libtasn1
.h \
sys/ucred.h sys/mount.h])
sys/un.h sys/syscall.h
sys/sysctl.h netinet/tcp.h ifaddrs
.h \
libtasn1.h
sys/ucred.h sys/mount.h])
dnl Check whether endian provides handy macros.
AC_CHECK_DECLS([htole64], [], [], [[#include <endian.h>]])
...
...
src/network/bridge_driver.c
浏览文件 @
f083ff82
...
...
@@ -41,6 +41,9 @@
#include <sys/wait.h>
#include <sys/ioctl.h>
#include <net/if.h>
#if HAVE_SYS_SYSCTL_H
# include <sys/sysctl.h>
#endif
#include "virerror.h"
#include "datatypes.h"
...
...
@@ -1545,10 +1548,20 @@ static int
networkEnableIpForwarding
(
bool
enableIPv4
,
bool
enableIPv6
)
{
int
ret
=
0
;
#ifdef HAVE_SYSCTLBYNAME
int
enabled
=
1
;
if
(
enableIPv4
)
ret
=
sysctlbyname
(
"net.inet.ip.forwarding"
,
NULL
,
0
,
&
enabled
,
sizeof
(
enabled
));
if
(
enableIPv6
&&
ret
==
0
)
ret
=
sysctlbyname
(
"net.inet6.ip6.forwarding"
,
NULL
,
0
,
&
enabled
,
sizeof
(
enabled
));
#else
if
(
enableIPv4
)
ret
=
virFileWriteStr
(
"/proc/sys/net/ipv4/ip_forward"
,
"1
\n
"
,
0
);
if
(
enableIPv6
&&
ret
==
0
)
ret
=
virFileWriteStr
(
"/proc/sys/net/ipv6/conf/all/forwarding"
,
"1
\n
"
,
0
);
#endif
return
ret
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录