Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
58d46711
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,发现更多精彩内容 >>
提交
58d46711
编写于
3月 18, 2014
作者:
M
Martin Kletzander
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use K&R style for curly braces in src/nwfilter/
Signed-off-by:
N
Martin Kletzander
<
mkletzan@redhat.com
>
上级
f84e1799
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
50 addition
and
26 deletion
+50
-26
src/nwfilter/nwfilter_driver.c
src/nwfilter/nwfilter_driver.c
+21
-11
src/nwfilter/nwfilter_ebiptables_driver.c
src/nwfilter/nwfilter_ebiptables_driver.c
+2
-1
src/nwfilter/nwfilter_learnipaddr.c
src/nwfilter/nwfilter_learnipaddr.c
+27
-14
未找到文件。
src/nwfilter/nwfilter_driver.c
浏览文件 @
58d46711
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* nwfilter_driver.c: core driver for network filter APIs
* nwfilter_driver.c: core driver for network filter APIs
* (based on storage_driver.c)
* (based on storage_driver.c)
*
*
* Copyright (C) 2006-2011 Red Hat, Inc.
* Copyright (C) 2006-2011
, 2014
Red Hat, Inc.
* Copyright (C) 2006-2008 Daniel P. Berrange
* Copyright (C) 2006-2008 Daniel P. Berrange
* Copyright (C) 2010 IBM Corporation
* Copyright (C) 2010 IBM Corporation
* Copyright (C) 2010 Stefan Berger
* Copyright (C) 2010 Stefan Berger
...
@@ -325,7 +325,8 @@ virNWFilterDriverIsWatchingFirewallD(void)
...
@@ -325,7 +325,8 @@ virNWFilterDriverIsWatchingFirewallD(void)
* Shutdown the nwfilter driver, it will stop all active nwfilters
* Shutdown the nwfilter driver, it will stop all active nwfilters
*/
*/
static
int
static
int
nwfilterStateCleanup
(
void
)
{
nwfilterStateCleanup
(
void
)
{
if
(
!
driverState
)
if
(
!
driverState
)
return
-
1
;
return
-
1
;
...
@@ -356,7 +357,8 @@ nwfilterStateCleanup(void) {
...
@@ -356,7 +357,8 @@ nwfilterStateCleanup(void) {
static
virNWFilterPtr
static
virNWFilterPtr
nwfilterLookupByUUID
(
virConnectPtr
conn
,
nwfilterLookupByUUID
(
virConnectPtr
conn
,
const
unsigned
char
*
uuid
)
{
const
unsigned
char
*
uuid
)
{
virNWFilterDriverStatePtr
driver
=
conn
->
nwfilterPrivateData
;
virNWFilterDriverStatePtr
driver
=
conn
->
nwfilterPrivateData
;
virNWFilterObjPtr
nwfilter
;
virNWFilterObjPtr
nwfilter
;
virNWFilterPtr
ret
=
NULL
;
virNWFilterPtr
ret
=
NULL
;
...
@@ -385,7 +387,8 @@ cleanup:
...
@@ -385,7 +387,8 @@ cleanup:
static
virNWFilterPtr
static
virNWFilterPtr
nwfilterLookupByName
(
virConnectPtr
conn
,
nwfilterLookupByName
(
virConnectPtr
conn
,
const
char
*
name
)
{
const
char
*
name
)
{
virNWFilterDriverStatePtr
driver
=
conn
->
nwfilterPrivateData
;
virNWFilterDriverStatePtr
driver
=
conn
->
nwfilterPrivateData
;
virNWFilterObjPtr
nwfilter
;
virNWFilterObjPtr
nwfilter
;
virNWFilterPtr
ret
=
NULL
;
virNWFilterPtr
ret
=
NULL
;
...
@@ -428,14 +431,16 @@ nwfilterOpen(virConnectPtr conn,
...
@@ -428,14 +431,16 @@ nwfilterOpen(virConnectPtr conn,
static
int
static
int
nwfilterClose
(
virConnectPtr
conn
)
{
nwfilterClose
(
virConnectPtr
conn
)
{
conn
->
nwfilterPrivateData
=
NULL
;
conn
->
nwfilterPrivateData
=
NULL
;
return
0
;
return
0
;
}
}
static
int
static
int
nwfilterConnectNumOfNWFilters
(
virConnectPtr
conn
)
{
nwfilterConnectNumOfNWFilters
(
virConnectPtr
conn
)
{
virNWFilterDriverStatePtr
driver
=
conn
->
nwfilterPrivateData
;
virNWFilterDriverStatePtr
driver
=
conn
->
nwfilterPrivateData
;
size_t
i
;
size_t
i
;
int
n
;
int
n
;
...
@@ -459,7 +464,8 @@ nwfilterConnectNumOfNWFilters(virConnectPtr conn) {
...
@@ -459,7 +464,8 @@ nwfilterConnectNumOfNWFilters(virConnectPtr conn) {
static
int
static
int
nwfilterConnectListNWFilters
(
virConnectPtr
conn
,
nwfilterConnectListNWFilters
(
virConnectPtr
conn
,
char
**
const
names
,
char
**
const
names
,
int
nnames
)
{
int
nnames
)
{
virNWFilterDriverStatePtr
driver
=
conn
->
nwfilterPrivateData
;
virNWFilterDriverStatePtr
driver
=
conn
->
nwfilterPrivateData
;
int
got
=
0
;
int
got
=
0
;
size_t
i
;
size_t
i
;
...
@@ -495,7 +501,8 @@ nwfilterConnectListNWFilters(virConnectPtr conn,
...
@@ -495,7 +501,8 @@ nwfilterConnectListNWFilters(virConnectPtr conn,
static
int
static
int
nwfilterConnectListAllNWFilters
(
virConnectPtr
conn
,
nwfilterConnectListAllNWFilters
(
virConnectPtr
conn
,
virNWFilterPtr
**
filters
,
virNWFilterPtr
**
filters
,
unsigned
int
flags
)
{
unsigned
int
flags
)
{
virNWFilterDriverStatePtr
driver
=
conn
->
nwfilterPrivateData
;
virNWFilterDriverStatePtr
driver
=
conn
->
nwfilterPrivateData
;
virNWFilterPtr
*
tmp_filters
=
NULL
;
virNWFilterPtr
*
tmp_filters
=
NULL
;
int
nfilters
=
0
;
int
nfilters
=
0
;
...
@@ -594,7 +601,8 @@ cleanup:
...
@@ -594,7 +601,8 @@ cleanup:
static
int
static
int
nwfilterUndefine
(
virNWFilterPtr
obj
)
{
nwfilterUndefine
(
virNWFilterPtr
obj
)
{
virNWFilterDriverStatePtr
driver
=
obj
->
conn
->
nwfilterPrivateData
;
virNWFilterDriverStatePtr
driver
=
obj
->
conn
->
nwfilterPrivateData
;
virNWFilterObjPtr
nwfilter
;
virNWFilterObjPtr
nwfilter
;
int
ret
=
-
1
;
int
ret
=
-
1
;
...
@@ -682,7 +690,8 @@ nwfilterInstantiateFilter(virConnectPtr conn,
...
@@ -682,7 +690,8 @@ nwfilterInstantiateFilter(virConnectPtr conn,
static
void
static
void
nwfilterTeardownFilter
(
virDomainNetDefPtr
net
)
{
nwfilterTeardownFilter
(
virDomainNetDefPtr
net
)
{
if
((
net
->
ifname
)
&&
(
net
->
filter
))
if
((
net
->
ifname
)
&&
(
net
->
filter
))
virNWFilterTeardownFilter
(
net
);
virNWFilterTeardownFilter
(
net
);
}
}
...
@@ -717,7 +726,8 @@ static virDomainConfNWFilterDriver domainNWFilterDriver = {
...
@@ -717,7 +726,8 @@ static virDomainConfNWFilterDriver domainNWFilterDriver = {
};
};
int
nwfilterRegister
(
void
)
{
int
nwfilterRegister
(
void
)
{
if
(
virRegisterNWFilterDriver
(
&
nwfilterDriver
)
<
0
)
if
(
virRegisterNWFilterDriver
(
&
nwfilterDriver
)
<
0
)
return
-
1
;
return
-
1
;
if
(
virRegisterStateDriver
(
&
stateDriver
)
<
0
)
if
(
virRegisterStateDriver
(
&
stateDriver
)
<
0
)
...
...
src/nwfilter/nwfilter_ebiptables_driver.c
浏览文件 @
58d46711
...
@@ -3198,7 +3198,8 @@ ebiptablesInstCommand(virBufferPtr buf,
...
@@ -3198,7 +3198,8 @@ ebiptablesInstCommand(virBufferPtr buf,
* In case of this driver we need the ebtables tool available.
* In case of this driver we need the ebtables tool available.
*/
*/
static
int
static
int
ebiptablesCanApplyBasicRules
(
void
)
{
ebiptablesCanApplyBasicRules
(
void
)
{
return
ebtables_cmd_path
!=
NULL
;
return
ebtables_cmd_path
!=
NULL
;
}
}
...
...
src/nwfilter/nwfilter_learnipaddr.c
浏览文件 @
58d46711
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* nwfilter_learnipaddr.c: support for learning IP address used by a VM
* nwfilter_learnipaddr.c: support for learning IP address used by a VM
* on an interface
* on an interface
*
*
* Copyright (C) 2011, 2013 Red Hat, Inc.
* Copyright (C) 2011, 2013
, 2014
Red Hat, Inc.
* Copyright (C) 2010 IBM Corp.
* Copyright (C) 2010 IBM Corp.
* Copyright (C) 2010 Stefan Berger
* Copyright (C) 2010 Stefan Berger
*
*
...
@@ -138,7 +138,8 @@ static bool threadsTerminate = false;
...
@@ -138,7 +138,8 @@ static bool threadsTerminate = false;
int
int
virNWFilterLockIface
(
const
char
*
ifname
)
{
virNWFilterLockIface
(
const
char
*
ifname
)
{
virNWFilterIfaceLockPtr
ifaceLock
;
virNWFilterIfaceLockPtr
ifaceLock
;
virMutexLock
(
&
ifaceMapLock
);
virMutexLock
(
&
ifaceMapLock
);
...
@@ -188,13 +189,15 @@ virNWFilterLockIface(const char *ifname) {
...
@@ -188,13 +189,15 @@ virNWFilterLockIface(const char *ifname) {
static
void
static
void
freeIfaceLock
(
void
*
payload
,
const
void
*
name
ATTRIBUTE_UNUSED
)
{
freeIfaceLock
(
void
*
payload
,
const
void
*
name
ATTRIBUTE_UNUSED
)
{
VIR_FREE
(
payload
);
VIR_FREE
(
payload
);
}
}
void
void
virNWFilterUnlockIface
(
const
char
*
ifname
)
{
virNWFilterUnlockIface
(
const
char
*
ifname
)
{
virNWFilterIfaceLockPtr
ifaceLock
;
virNWFilterIfaceLockPtr
ifaceLock
;
virMutexLock
(
&
ifaceMapLock
);
virMutexLock
(
&
ifaceMapLock
);
...
@@ -214,7 +217,8 @@ virNWFilterUnlockIface(const char *ifname) {
...
@@ -214,7 +217,8 @@ virNWFilterUnlockIface(const char *ifname) {
static
void
static
void
virNWFilterIPAddrLearnReqFree
(
virNWFilterIPAddrLearnReqPtr
req
)
{
virNWFilterIPAddrLearnReqFree
(
virNWFilterIPAddrLearnReqPtr
req
)
{
if
(
!
req
)
if
(
!
req
)
return
;
return
;
...
@@ -228,7 +232,8 @@ virNWFilterIPAddrLearnReqFree(virNWFilterIPAddrLearnReqPtr req) {
...
@@ -228,7 +232,8 @@ virNWFilterIPAddrLearnReqFree(virNWFilterIPAddrLearnReqPtr req) {
#if HAVE_LIBPCAP
#if HAVE_LIBPCAP
static
int
static
int
virNWFilterRegisterLearnReq
(
virNWFilterIPAddrLearnReqPtr
req
)
{
virNWFilterRegisterLearnReq
(
virNWFilterIPAddrLearnReqPtr
req
)
{
int
res
=
-
1
;
int
res
=
-
1
;
IFINDEX2STR
(
ifindex_str
,
req
->
ifindex
);
IFINDEX2STR
(
ifindex_str
,
req
->
ifindex
);
...
@@ -246,7 +251,8 @@ virNWFilterRegisterLearnReq(virNWFilterIPAddrLearnReqPtr req) {
...
@@ -246,7 +251,8 @@ virNWFilterRegisterLearnReq(virNWFilterIPAddrLearnReqPtr req) {
#endif
#endif
int
int
virNWFilterTerminateLearnReq
(
const
char
*
ifname
)
{
virNWFilterTerminateLearnReq
(
const
char
*
ifname
)
{
int
rc
=
-
1
;
int
rc
=
-
1
;
int
ifindex
;
int
ifindex
;
virNWFilterIPAddrLearnReqPtr
req
;
virNWFilterIPAddrLearnReqPtr
req
;
...
@@ -281,7 +287,8 @@ virNWFilterTerminateLearnReq(const char *ifname) {
...
@@ -281,7 +287,8 @@ virNWFilterTerminateLearnReq(const char *ifname) {
virNWFilterIPAddrLearnReqPtr
virNWFilterIPAddrLearnReqPtr
virNWFilterLookupLearnReq
(
int
ifindex
)
{
virNWFilterLookupLearnReq
(
int
ifindex
)
{
void
*
res
;
void
*
res
;
IFINDEX2STR
(
ifindex_str
,
ifindex
);
IFINDEX2STR
(
ifindex_str
,
ifindex
);
...
@@ -296,7 +303,8 @@ virNWFilterLookupLearnReq(int ifindex) {
...
@@ -296,7 +303,8 @@ virNWFilterLookupLearnReq(int ifindex) {
static
void
static
void
freeLearnReqEntry
(
void
*
payload
,
const
void
*
name
ATTRIBUTE_UNUSED
)
{
freeLearnReqEntry
(
void
*
payload
,
const
void
*
name
ATTRIBUTE_UNUSED
)
{
virNWFilterIPAddrLearnReqFree
(
payload
);
virNWFilterIPAddrLearnReqFree
(
payload
);
}
}
...
@@ -304,7 +312,8 @@ freeLearnReqEntry(void *payload, const void *name ATTRIBUTE_UNUSED) {
...
@@ -304,7 +312,8 @@ freeLearnReqEntry(void *payload, const void *name ATTRIBUTE_UNUSED) {
#ifdef HAVE_LIBPCAP
#ifdef HAVE_LIBPCAP
static
virNWFilterIPAddrLearnReqPtr
static
virNWFilterIPAddrLearnReqPtr
virNWFilterDeregisterLearnReq
(
int
ifindex
)
{
virNWFilterDeregisterLearnReq
(
int
ifindex
)
{
virNWFilterIPAddrLearnReqPtr
res
;
virNWFilterIPAddrLearnReqPtr
res
;
IFINDEX2STR
(
ifindex_str
,
ifindex
);
IFINDEX2STR
(
ifindex_str
,
ifindex
);
...
@@ -324,7 +333,8 @@ virNWFilterDeregisterLearnReq(int ifindex) {
...
@@ -324,7 +333,8 @@ virNWFilterDeregisterLearnReq(int ifindex) {
static
void
static
void
procDHCPOpts
(
struct
dhcp
*
dhcp
,
int
dhcp_opts_len
,
procDHCPOpts
(
struct
dhcp
*
dhcp
,
int
dhcp_opts_len
,
uint32_t
*
vmaddr
,
uint32_t
*
bcastaddr
,
uint32_t
*
vmaddr
,
uint32_t
*
bcastaddr
,
enum
howDetect
*
howDetected
)
{
enum
howDetect
*
howDetected
)
{
struct
dhcp_option
*
dhcpopt
=
&
dhcp
->
options
[
0
];
struct
dhcp_option
*
dhcpopt
=
&
dhcp
->
options
[
0
];
while
(
dhcp_opts_len
>=
2
)
{
while
(
dhcp_opts_len
>=
2
)
{
...
@@ -683,7 +693,8 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver,
...
@@ -683,7 +693,8 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver,
const
char
*
filtername
,
const
char
*
filtername
,
virNWFilterHashTablePtr
filterparams
,
virNWFilterHashTablePtr
filterparams
,
virNWFilterDriverStatePtr
driver
,
virNWFilterDriverStatePtr
driver
,
enum
howDetect
howDetect
)
{
enum
howDetect
howDetect
)
{
int
rc
;
int
rc
;
virNWFilterIPAddrLearnReqPtr
req
=
NULL
;
virNWFilterIPAddrLearnReqPtr
req
=
NULL
;
virNWFilterHashTablePtr
ht
=
NULL
;
virNWFilterHashTablePtr
ht
=
NULL
;
...
@@ -788,7 +799,8 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver ATTRIBUTE_UNUSED,
...
@@ -788,7 +799,8 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver ATTRIBUTE_UNUSED,
* Initialization of this layer
* Initialization of this layer
*/
*/
int
int
virNWFilterLearnInit
(
void
)
{
virNWFilterLearnInit
(
void
)
{
if
(
pendingLearnReq
)
if
(
pendingLearnReq
)
return
0
;
return
0
;
...
@@ -822,7 +834,8 @@ virNWFilterLearnInit(void) {
...
@@ -822,7 +834,8 @@ virNWFilterLearnInit(void) {
void
void
virNWFilterLearnThreadsTerminate
(
bool
allowNewThreads
)
{
virNWFilterLearnThreadsTerminate
(
bool
allowNewThreads
)
{
threadsTerminate
=
true
;
threadsTerminate
=
true
;
while
(
virHashSize
(
pendingLearnReq
)
!=
0
)
while
(
virHashSize
(
pendingLearnReq
)
!=
0
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录