Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
fwdriver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
b1757b8c
authored
Feb 24, 2015
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow BRIDGE_TYPE=NONE option
parent
bbcea33e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
10 deletions
+21
-10
fw.py
+6
-8
utils.py
+15
-2
No files found.
fw.py
View file @
b1757b8c
...
...
@@ -4,8 +4,7 @@ import re
import
json
import
logging
from
ovs
import
Switch
,
Bridge
from
utils
import
(
ns_exec
,
sudo
,
ADDRESSES
,
from
utils
import
(
ns_exec
,
sudo
,
ADDRESSES
,
get_network_type
,
dhcp_no_free_re
,
dhcp_ack_re
)
DHCP_LOGFILE
=
getenv
(
'DHCP_LOGFILE'
,
'/var/log/syslog'
)
...
...
@@ -26,12 +25,6 @@ celery.conf.update(CELERY_CACHE_BACKEND=CACHE_URI,
logger
=
logging
.
getLogger
(
__name__
)
if
getenv
(
'BRIDGE_TYPE'
,
'OVS'
)
==
'BRIDGE'
:
network_type
=
Bridge
else
:
network_type
=
Switch
@task
(
name
=
"firewall.reload_firewall"
)
def
reload_firewall
(
data4
,
data6
,
save_config
=
True
):
try
:
...
...
@@ -50,6 +43,11 @@ def reload_firewall(data4, data6, save_config=True):
@task
(
name
=
"firewall.reload_firewall_vlan"
)
def
reload_firewall_vlan
(
data
,
save_config
=
True
):
network_type
=
get_network_type
()
if
network_type
is
None
:
logger
.
info
(
"Ignored reload_firewall_vlan() network type=
%
s"
,
network_type
)
return
# Add additional addresses from config
for
k
,
v
in
ADDRESSES
.
items
():
data
[
k
][
'addresses'
]
+=
v
...
...
utils.py
View file @
b1757b8c
...
...
@@ -13,6 +13,16 @@ MAC = getenv('MAC')
ADDRESSES
=
json
.
loads
(
getenv
(
'ADDRESSES'
,
'{}'
))
HA
=
bool
(
getenv
(
'HA'
,
False
))
def
get_network_type
():
from
ovs
import
Switch
,
Bridge
if
getenv
(
'BRIDGE_TYPE'
,
'OVS'
)
==
'BRIDGE'
:
return
Bridge
elif
getenv
(
'BRIDGE_TYPE'
,
'OVS'
)
==
'NONE'
:
return
None
else
:
return
Switch
# 2013-06-26 12:16:59 DHCPACK on 10.4.0.14 to 5c:b5:24:e6:5c:81
# (android_b555bfdba7c837d) via vlan0004
...
...
@@ -45,5 +55,8 @@ def sudo(args, stdin=None):
def
ns_exec
(
args
,
stdin
=
None
):
return
sudo
((
'/sbin/ip'
,
'netns'
,
'exec'
,
NETNS
)
+
args
,
stdin
)
if
get_network_type
()
is
None
:
return
sudo
(
args
,
stdin
)
else
:
return
sudo
((
'/sbin/ip'
,
'netns'
,
'exec'
,
NETNS
)
+
args
,
stdin
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment