Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
05725e9b
L
libvirt
项目概览
openeuler
/
libvirt
通知
3
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
05725e9b
编写于
10月 22, 2010
作者:
M
Matthias Bolte
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vbox: Fix compile errors due to the virSocketAddr series
上级
4af71829
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
100 addition
and
16 deletion
+100
-16
src/vbox/vbox_tmpl.c
src/vbox/vbox_tmpl.c
+100
-16
未找到文件。
src/vbox/vbox_tmpl.c
浏览文件 @
05725e9b
...
...
@@ -626,6 +626,45 @@ static PRUnichar *PRUnicharFromInt(int n) {
#endif
/* !(VBOX_API_VERSION == 2002) */
static
PRUnichar
*
vboxSocketFormatAddrUtf16
(
vboxGlobalData
*
data
,
virSocketAddrPtr
addr
)
{
char
*
utf8
=
NULL
;
PRUnichar
*
utf16
=
NULL
;
utf8
=
virSocketFormatAddr
(
addr
);
if
(
utf8
==
NULL
)
{
return
NULL
;
}
VBOX_UTF8_TO_UTF16
(
utf8
,
&
utf16
);
VIR_FREE
(
utf8
);
return
utf16
;
}
static
int
vboxSocketParseAddrUtf16
(
vboxGlobalData
*
data
,
const
PRUnichar
*
utf16
,
virSocketAddrPtr
addr
)
{
int
result
=
-
1
;
char
*
utf8
=
NULL
;
VBOX_UTF16_TO_UTF8
(
utf16
,
&
utf8
);
if
(
virSocketParseAddr
(
utf8
,
addr
,
AF_UNSPEC
)
<
0
)
{
goto
cleanup
;
}
result
=
0
;
cleanup:
VBOX_UTF8_FREE
(
utf8
);
return
result
;
}
static
virCapsPtr
vboxCapsInit
(
void
)
{
struct
utsname
utsname
;
virCapsPtr
caps
;
...
...
@@ -7073,8 +7112,8 @@ static virNetworkPtr vboxNetworkDefineCreateXML(virConnectPtr conn, const char *
* with contigious address space from start to end
*/
if
((
def
->
nranges
>=
1
)
&&
(
def
->
ranges
[
0
].
start
)
&&
(
def
->
ranges
[
0
].
end
))
{
VIR_SOCKET_HAS_ADDR
(
&
def
->
ranges
[
0
].
start
)
&&
VIR_SOCKET_HAS_ADDR
(
&
def
->
ranges
[
0
].
end
))
{
IDHCPServer
*
dhcpServer
=
NULL
;
data
->
vboxObj
->
vtbl
->
FindDHCPServerByNetworkName
(
data
->
vboxObj
,
...
...
@@ -7094,11 +7133,21 @@ static virNetworkPtr vboxNetworkDefineCreateXML(virConnectPtr conn, const char *
PRUnichar
*
toIPAddressUtf16
=
NULL
;
PRUnichar
*
trunkTypeUtf16
=
NULL
;
ipAddressUtf16
=
vboxSocketFormatAddrUtf16
(
data
,
&
def
->
ipAddress
);
networkMaskUtf16
=
vboxSocketFormatAddrUtf16
(
data
,
&
def
->
netmask
);
fromIPAddressUtf16
=
vboxSocketFormatAddrUtf16
(
data
,
&
def
->
ranges
[
0
].
start
);
toIPAddressUtf16
=
vboxSocketFormatAddrUtf16
(
data
,
&
def
->
ranges
[
0
].
end
);
if
(
ipAddressUtf16
==
NULL
||
networkMaskUtf16
==
NULL
||
fromIPAddressUtf16
==
NULL
||
toIPAddressUtf16
==
NULL
)
{
VBOX_UTF16_FREE
(
ipAddressUtf16
);
VBOX_UTF16_FREE
(
networkMaskUtf16
);
VBOX_UTF16_FREE
(
fromIPAddressUtf16
);
VBOX_UTF16_FREE
(
toIPAddressUtf16
);
VBOX_RELEASE
(
dhcpServer
);
goto
cleanup
;
}
VBOX_UTF8_TO_UTF16
(
def
->
ipAddress
,
&
ipAddressUtf16
);
VBOX_UTF8_TO_UTF16
(
def
->
netmask
,
&
networkMaskUtf16
);
VBOX_UTF8_TO_UTF16
(
def
->
ranges
[
0
].
start
,
&
fromIPAddressUtf16
);
VBOX_UTF8_TO_UTF16
(
def
->
ranges
[
0
].
end
,
&
toIPAddressUtf16
);
VBOX_UTF8_TO_UTF16
(
"netflt"
,
&
trunkTypeUtf16
);
dhcpServer
->
vtbl
->
SetEnabled
(
dhcpServer
,
PR_TRUE
);
...
...
@@ -7125,12 +7174,18 @@ static virNetworkPtr vboxNetworkDefineCreateXML(virConnectPtr conn, const char *
}
if
((
def
->
nhosts
>=
1
)
&&
(
def
->
hosts
[
0
].
ip
))
{
VIR_SOCKET_HAS_ADDR
(
&
def
->
hosts
[
0
].
ip
))
{
PRUnichar
*
ipAddressUtf16
=
NULL
;
PRUnichar
*
networkMaskUtf16
=
NULL
;
VBOX_UTF8_TO_UTF16
(
def
->
netmask
,
&
networkMaskUtf16
);
VBOX_UTF8_TO_UTF16
(
def
->
hosts
[
0
].
ip
,
&
ipAddressUtf16
);
ipAddressUtf16
=
vboxSocketFormatAddrUtf16
(
data
,
&
def
->
hosts
[
0
].
ip
);
networkMaskUtf16
=
vboxSocketFormatAddrUtf16
(
data
,
&
def
->
netmask
);
if
(
ipAddressUtf16
==
NULL
||
networkMaskUtf16
==
NULL
)
{
VBOX_UTF16_FREE
(
ipAddressUtf16
);
VBOX_UTF16_FREE
(
networkMaskUtf16
);
goto
cleanup
;
}
/* Current drawback is that since EnableStaticIpConfig() sets
* IP and enables the interface so even if the dhcpserver is not
...
...
@@ -7393,6 +7448,7 @@ static char *vboxNetworkDumpXML(virNetworkPtr network, int flags ATTRIBUTE_UNUSE
PRUnichar
*
networkMaskUtf16
=
NULL
;
PRUnichar
*
fromIPAddressUtf16
=
NULL
;
PRUnichar
*
toIPAddressUtf16
=
NULL
;
bool
errorOccurred
=
false
;
dhcpServer
->
vtbl
->
GetIPAddress
(
dhcpServer
,
&
ipAddressUtf16
);
dhcpServer
->
vtbl
->
GetNetworkMask
(
dhcpServer
,
&
networkMaskUtf16
);
...
...
@@ -7401,15 +7457,25 @@ static char *vboxNetworkDumpXML(virNetworkPtr network, int flags ATTRIBUTE_UNUSE
/* Currently virtualbox supports only one dhcp server per network
* with contigious address space from start to end
*/
VBOX_UTF16_TO_UTF8
(
ipAddressUtf16
,
&
def
->
ipAddress
);
VBOX_UTF16_TO_UTF8
(
networkMaskUtf16
,
&
def
->
netmask
);
VBOX_UTF16_TO_UTF8
(
fromIPAddressUtf16
,
&
def
->
ranges
[
0
].
start
);
VBOX_UTF16_TO_UTF8
(
toIPAddressUtf16
,
&
def
->
ranges
[
0
].
end
);
if
(
vboxSocketParseAddrUtf16
(
data
,
ipAddressUtf16
,
&
def
->
ipAddress
)
<
0
||
vboxSocketParseAddrUtf16
(
data
,
networkMaskUtf16
,
&
def
->
netmask
)
<
0
||
vboxSocketParseAddrUtf16
(
data
,
fromIPAddressUtf16
,
&
def
->
ranges
[
0
].
start
)
<
0
||
vboxSocketParseAddrUtf16
(
data
,
toIPAddressUtf16
,
&
def
->
ranges
[
0
].
end
)
<
0
)
{
errorOccurred
=
true
;
}
VBOX_UTF16_FREE
(
ipAddressUtf16
);
VBOX_UTF16_FREE
(
networkMaskUtf16
);
VBOX_UTF16_FREE
(
fromIPAddressUtf16
);
VBOX_UTF16_FREE
(
toIPAddressUtf16
);
if
(
errorOccurred
)
{
goto
cleanup
;
}
}
else
{
def
->
nranges
=
0
;
virReportOOMError
();
...
...
@@ -7425,15 +7491,24 @@ static char *vboxNetworkDumpXML(virNetworkPtr network, int flags ATTRIBUTE_UNUSE
}
else
{
PRUnichar
*
macAddressUtf16
=
NULL
;
PRUnichar
*
ipAddressUtf16
=
NULL
;
bool
errorOccurred
=
false
;
networkInterface
->
vtbl
->
GetHardwareAddress
(
networkInterface
,
&
macAddressUtf16
);
networkInterface
->
vtbl
->
GetIPAddress
(
networkInterface
,
&
ipAddressUtf16
);
VBOX_UTF16_TO_UTF8
(
macAddressUtf16
,
&
def
->
hosts
[
0
].
mac
);
VBOX_UTF16_TO_UTF8
(
ipAddressUtf16
,
&
def
->
hosts
[
0
].
ip
);
if
(
vboxSocketParseAddrUtf16
(
data
,
ipAddressUtf16
,
&
def
->
hosts
[
0
].
ip
)
<
0
)
{
errorOccurred
=
true
;
}
VBOX_UTF16_FREE
(
macAddressUtf16
);
VBOX_UTF16_FREE
(
ipAddressUtf16
);
if
(
errorOccurred
)
{
goto
cleanup
;
}
}
}
else
{
def
->
nhosts
=
0
;
...
...
@@ -7443,15 +7518,24 @@ static char *vboxNetworkDumpXML(virNetworkPtr network, int flags ATTRIBUTE_UNUSE
}
else
{
PRUnichar
*
networkMaskUtf16
=
NULL
;
PRUnichar
*
ipAddressUtf16
=
NULL
;
bool
errorOccurred
=
false
;
networkInterface
->
vtbl
->
GetNetworkMask
(
networkInterface
,
&
networkMaskUtf16
);
networkInterface
->
vtbl
->
GetIPAddress
(
networkInterface
,
&
ipAddressUtf16
);
VBOX_UTF16_TO_UTF8
(
networkMaskUtf16
,
&
def
->
netmask
);
VBOX_UTF16_TO_UTF8
(
ipAddressUtf16
,
&
def
->
ipAddress
);
if
(
vboxSocketParseAddrUtf16
(
data
,
networkMaskUtf16
,
&
def
->
netmask
)
<
0
||
vboxSocketParseAddrUtf16
(
data
,
ipAddressUtf16
,
&
def
->
ipAddress
)
<
0
)
{
errorOccurred
=
true
;
}
VBOX_UTF16_FREE
(
networkMaskUtf16
);
VBOX_UTF16_FREE
(
ipAddressUtf16
);
if
(
errorOccurred
)
{
goto
cleanup
;
}
}
DEBUGIID
(
"Network UUID"
,
vboxnet0IID
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录