Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
57bd312c
authored
Oct 08, 2013
by
Bach Dániel
Committed by
Bach Dániel
Oct 14, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall: replace prefix_to_mask() with IPNetwork.netmask
parent
3d3bfaae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
12 deletions
+2
-12
circle/firewall/fw.py
+2
-12
No files found.
circle/firewall/fw.py
View file @
57bd312c
...
@@ -376,16 +376,6 @@ def dns():
...
@@ -376,16 +376,6 @@ def dns():
return
DNS
return
DNS
def
prefix_to_mask
(
prefix
):
t
=
[
0
,
0
,
0
,
0
]
for
i
in
range
(
0
,
4
):
if
prefix
>
i
*
8
+
7
:
t
[
i
]
=
255
elif
i
*
8
<
prefix
and
prefix
<=
(
i
+
1
)
*
8
:
t
[
i
]
=
256
-
(
2
**
((
i
+
1
)
*
8
-
prefix
))
return
"."
.
join
([
str
(
i
)
for
i
in
t
])
def
dhcp
():
def
dhcp
():
vlans
=
models
.
Vlan
.
objects
.
all
()
vlans
=
models
.
Vlan
.
objects
.
all
()
regex
=
re
.
compile
(
r'^([0-9]+)\.([0-9]+)\.[0-9]+\.[0-9]+\s+'
regex
=
re
.
compile
(
r'^([0-9]+)\.([0-9]+)\.[0-9]+\.[0-9]+\s+'
...
@@ -411,8 +401,8 @@ def dhcp():
...
@@ -411,8 +401,8 @@ def dhcp():
filename
\"
pxelinux.0
\"
;
filename
\"
pxelinux.0
\"
;
allow bootp; allow booting;
allow bootp; allow booting;
}'''
%
{
}'''
%
{
'net'
:
i_vlan
.
net4
,
'net'
:
str
(
i_vlan
.
network4
.
network
)
,
'netmask'
:
prefix_to_mask
(
i_vlan
.
prefix4
),
'netmask'
:
str
(
i_vlan
.
network4
.
netmask
),
'domain'
:
i_vlan
.
domain
,
'domain'
:
i_vlan
.
domain
,
'router'
:
i_vlan
.
ipv4
,
'router'
:
i_vlan
.
ipv4
,
'ntp'
:
i_vlan
.
ipv4
,
'ntp'
:
i_vlan
.
ipv4
,
...
...
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