Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
0ca51d5c
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,发现更多精彩内容 >>
提交
0ca51d5c
编写于
5月 03, 2013
作者:
M
Michal Privoznik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adapt to VIR_STRDUP and VIR_STRNDUP in src/nwfilter/*
上级
e3221e64
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
18 addition
and
23 deletion
+18
-23
src/nwfilter/nwfilter_dhcpsnoop.c
src/nwfilter/nwfilter_dhcpsnoop.c
+11
-11
src/nwfilter/nwfilter_driver.c
src/nwfilter/nwfilter_driver.c
+3
-4
src/nwfilter/nwfilter_ebiptables_driver.c
src/nwfilter/nwfilter_ebiptables_driver.c
+1
-1
src/nwfilter/nwfilter_gentech_driver.c
src/nwfilter/nwfilter_gentech_driver.c
+2
-3
src/nwfilter/nwfilter_learnipaddr.c
src/nwfilter/nwfilter_learnipaddr.c
+1
-4
未找到文件。
src/nwfilter/nwfilter_dhcpsnoop.c
浏览文件 @
0ca51d5c
...
@@ -133,11 +133,11 @@ struct _virNWFilterSnoopReq {
...
@@ -133,11 +133,11 @@ struct _virNWFilterSnoopReq {
virNWFilterTechDriverPtr
techdriver
;
virNWFilterTechDriverPtr
techdriver
;
char
*
ifname
;
char
*
ifname
;
int
ifindex
;
int
ifindex
;
c
onst
char
*
linkdev
;
c
har
*
linkdev
;
enum
virDomainNetType
nettype
;
enum
virDomainNetType
nettype
;
char
ifkey
[
VIR_IFKEY_LEN
];
char
ifkey
[
VIR_IFKEY_LEN
];
virMacAddr
macaddr
;
virMacAddr
macaddr
;
c
onst
char
*
filtername
;
c
har
*
filtername
;
virNWFilterHashTablePtr
vars
;
virNWFilterHashTablePtr
vars
;
virNWFilterDriverStatePtr
driver
;
virNWFilterDriverStatePtr
driver
;
/* start and end of lease list, ordered by lease time */
/* start and end of lease list, ordered by lease time */
...
@@ -1110,10 +1110,8 @@ virNWFilterSnoopDHCPOpen(const char *ifname, virMacAddr *mac,
...
@@ -1110,10 +1110,8 @@ virNWFilterSnoopDHCPOpen(const char *ifname, virMacAddr *mac,
* generate much more traffic than if we filtered by VM and
* generate much more traffic than if we filtered by VM and
* braodcast MAC as well
* braodcast MAC as well
*/
*/
if
(
!
(
ext_filter
=
strdup
(
filter
)))
{
if
(
VIR_STRDUP
(
ext_filter
,
filter
)
<
0
)
virReportOOMError
();
return
NULL
;
return
NULL
;
}
}
}
handle
=
pcap_create
(
ifname
,
pcap_errbuf
);
handle
=
pcap_create
(
ifname
,
pcap_errbuf
);
...
@@ -1408,7 +1406,7 @@ virNWFilterDHCPSnoopThread(void *req0)
...
@@ -1408,7 +1406,7 @@ virNWFilterDHCPSnoopThread(void *req0)
fds
[
i
].
fd
=
pcap_fileno
(
pcapConf
[
i
].
handle
);
fds
[
i
].
fd
=
pcap_fileno
(
pcapConf
[
i
].
handle
);
}
}
tmp
=
virNetDevGetIndex
(
req
->
ifname
,
&
ifindex
);
tmp
=
virNetDevGetIndex
(
req
->
ifname
,
&
ifindex
);
threadkey
=
strdup
(
req
->
threadkey
);
ignore_value
(
VIR_STRDUP
(
threadkey
,
req
->
threadkey
)
);
worker
=
virThreadPoolNew
(
1
,
1
,
0
,
worker
=
virThreadPoolNew
(
1
,
1
,
0
,
virNWFilterDHCPDecodeWorker
,
virNWFilterDHCPDecodeWorker
,
req
);
req
);
...
@@ -1631,15 +1629,17 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver,
...
@@ -1631,15 +1629,17 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver,
req
->
driver
=
driver
;
req
->
driver
=
driver
;
req
->
techdriver
=
techdriver
;
req
->
techdriver
=
techdriver
;
tmp
=
virNetDevGetIndex
(
ifname
,
&
req
->
ifindex
);
tmp
=
virNetDevGetIndex
(
ifname
,
&
req
->
ifindex
);
req
->
linkdev
=
linkdev
?
strdup
(
linkdev
)
:
NULL
;
req
->
nettype
=
nettype
;
req
->
nettype
=
nettype
;
req
->
ifname
=
strdup
(
ifname
);
virMacAddrSet
(
&
req
->
macaddr
,
macaddr
);
virMacAddrSet
(
&
req
->
macaddr
,
macaddr
);
req
->
filtername
=
strdup
(
filtername
);
req
->
vars
=
virNWFilterHashTableCreate
(
0
);
req
->
vars
=
virNWFilterHashTableCreate
(
0
);
req
->
linkdev
=
NULL
;
if
(
VIR_STRDUP
(
req
->
ifname
,
ifname
)
<
0
||
VIR_STRDUP
(
req
->
filtername
,
filtername
)
<
0
||
VIR_STRDUP
(
req
->
linkdev
,
linkdev
)
<
0
)
goto
exit_snoopreqput
;
if
(
!
req
->
ifname
||
!
req
->
filtername
||
!
req
->
vars
||
tmp
<
0
||
if
(
!
req
->
vars
||
tmp
<
0
)
{
(
linkdev
!=
NULL
&&
req
->
linkdev
==
NULL
))
{
virReportOOMError
();
virReportOOMError
();
goto
exit_snoopreqput
;
goto
exit_snoopreqput
;
}
}
...
...
src/nwfilter/nwfilter_driver.c
浏览文件 @
0ca51d5c
...
@@ -221,8 +221,8 @@ nwfilterStateInitialize(bool privileged,
...
@@ -221,8 +221,8 @@ nwfilterStateInitialize(bool privileged,
goto
error
;
goto
error
;
}
}
if
(
(
base
=
strdup
(
SYSCONFDIR
"/libvirt"
))
==
NULL
)
if
(
VIR_STRDUP
(
base
,
SYSCONFDIR
"/libvirt"
)
<
0
)
goto
out_of_memory
;
goto
error
;
if
(
virAsprintf
(
&
driverState
->
configDir
,
if
(
virAsprintf
(
&
driverState
->
configDir
,
"%s/nwfilter"
,
base
)
==
-
1
)
"%s/nwfilter"
,
base
)
==
-
1
)
...
@@ -454,9 +454,8 @@ nwfilterConnectListNWFilters(virConnectPtr conn,
...
@@ -454,9 +454,8 @@ nwfilterConnectListNWFilters(virConnectPtr conn,
nwfilterDriverLock
(
driver
);
nwfilterDriverLock
(
driver
);
for
(
i
=
0
;
i
<
driver
->
nwfilters
.
count
&&
got
<
nnames
;
i
++
)
{
for
(
i
=
0
;
i
<
driver
->
nwfilters
.
count
&&
got
<
nnames
;
i
++
)
{
virNWFilterObjLock
(
driver
->
nwfilters
.
objs
[
i
]);
virNWFilterObjLock
(
driver
->
nwfilters
.
objs
[
i
]);
if
(
!
(
names
[
got
]
=
strdup
(
driver
->
nwfilters
.
objs
[
i
]
->
def
->
name
))
)
{
if
(
VIR_STRDUP
(
names
[
got
],
driver
->
nwfilters
.
objs
[
i
]
->
def
->
name
)
<
0
)
{
virNWFilterObjUnlock
(
driver
->
nwfilters
.
objs
[
i
]);
virNWFilterObjUnlock
(
driver
->
nwfilters
.
objs
[
i
]);
virReportOOMError
();
goto
cleanup
;
goto
cleanup
;
}
}
got
++
;
got
++
;
...
...
src/nwfilter/nwfilter_ebiptables_driver.c
浏览文件 @
0ca51d5c
...
@@ -2982,7 +2982,7 @@ ebtablesCreateTmpSubChain(ebiptablesRuleInstPtr *inst,
...
@@ -2982,7 +2982,7 @@ ebtablesCreateTmpSubChain(ebiptablesRuleInstPtr *inst,
switch
(
protoidx
)
{
switch
(
protoidx
)
{
case
L2_PROTO_MAC_IDX
:
case
L2_PROTO_MAC_IDX
:
protostr
=
strdup
(
""
);
ignore_value
(
VIR_STRDUP
(
protostr
,
""
)
);
break
;
break
;
case
L2_PROTO_STP_IDX
:
case
L2_PROTO_STP_IDX
:
ignore_value
(
virAsprintf
(
&
protostr
,
"-d "
NWFILTER_MAC_BGA
" "
));
ignore_value
(
virAsprintf
(
&
protostr
,
"-d "
NWFILTER_MAC_BGA
" "
));
...
...
src/nwfilter/nwfilter_gentech_driver.c
浏览文件 @
0ca51d5c
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
#include "nwfilter_learnipaddr.h"
#include "nwfilter_learnipaddr.h"
#include "virnetdev.h"
#include "virnetdev.h"
#include "datatypes.h"
#include "datatypes.h"
#include "virstring.h"
#define VIR_FROM_THIS VIR_FROM_NWFILTER
#define VIR_FROM_THIS VIR_FROM_NWFILTER
...
@@ -866,9 +867,7 @@ __virNWFilterInstantiateFilter(const unsigned char *vmuuid,
...
@@ -866,9 +867,7 @@ __virNWFilterInstantiateFilter(const unsigned char *vmuuid,
}
}
virMacAddrFormat
(
macaddr
,
vmmacaddr
);
virMacAddrFormat
(
macaddr
,
vmmacaddr
);
str_macaddr
=
strdup
(
vmmacaddr
);
if
(
VIR_STRDUP
(
str_macaddr
,
vmmacaddr
)
<
0
)
{
if
(
!
str_macaddr
)
{
virReportOOMError
();
rc
=
-
1
;
rc
=
-
1
;
goto
err_exit
;
goto
err_exit
;
}
}
...
...
src/nwfilter/nwfilter_learnipaddr.c
浏览文件 @
0ca51d5c
...
@@ -705,11 +705,8 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver,
...
@@ -705,11 +705,8 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver,
if
(
virNWFilterHashTablePutAll
(
filterparams
,
ht
)
<
0
)
if
(
virNWFilterHashTablePutAll
(
filterparams
,
ht
)
<
0
)
goto
err_free_ht
;
goto
err_free_ht
;
req
->
filtername
=
strdup
(
filtername
);
if
(
VIR_STRDUP
(
req
->
filtername
,
filtername
)
<
0
)
if
(
req
->
filtername
==
NULL
)
{
virReportOOMError
();
goto
err_free_ht
;
goto
err_free_ht
;
}
if
(
virStrcpyStatic
(
req
->
ifname
,
ifname
)
==
NULL
)
{
if
(
virStrcpyStatic
(
req
->
ifname
,
ifname
)
==
NULL
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录