Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
df2e6481
authored
Mar 18, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall: use IPAddress.words instead of regex matching in convert_ipv4_to_ipv6()
parent
de1ac429
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
circle/firewall/fields.py
+5
-7
No files found.
circle/firewall/fields.py
View file @
df2e6481
...
...
@@ -263,10 +263,8 @@ def val_mx(value):
def
convert_ipv4_to_ipv6
(
ipv6_template
,
ipv4
):
"""Convert IPv4 address string to IPv6 address string."""
ipv4
=
str
(
ipv4
)
val_ipv4
(
ipv4
)
m
=
ipv4_re
.
match
(
ipv4
)
return
IPAddress
(
ipv6_template
%
{
'a'
:
int
(
m
.
group
(
1
)),
'b'
:
int
(
m
.
group
(
2
)),
'c'
:
int
(
m
.
group
(
3
)),
'd'
:
int
(
m
.
group
(
4
))})
m
=
ipv4
.
words
return
IPAddress
(
ipv6_template
%
{
'a'
:
int
(
m
[
0
]),
'b'
:
int
(
m
[
1
]),
'c'
:
int
(
m
[
2
]),
'd'
:
int
(
m
[
3
])})
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