Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
snf-nfdhcpd
Commits
b526f9ae
Commit
b526f9ae
authored
Sep 05, 2012
by
Stratos Psomadakis
Committed by
root
Sep 05, 2012
Browse files
Catch IPy exceptions for invalid networks/subnets
Signed-off-by:
Stratos Psomadakis
<
psomas@grnet.gr
>
parent
d9361b6e
Changes
1
Hide whitespace changes
Inline
Side-by-side
nfdhcpd
View file @
b526f9ae
...
...
@@ -195,9 +195,13 @@ def parse_binding_file(path):
elif
line
.
startswith
(
"EUI64="
):
eui64
=
get_value
(
line
)
return
Client
(
tap
=
tap
,
mac
=
mac
,
ip
=
ip
,
try
:
client
=
Client
(
tap
=
tap
,
mac
=
mac
,
ip
=
ip
,
hostname
=
hostname
,
indev
=
indev
,
subnet
=
subnet
,
gateway
=
gateway
,
subnet6
=
subnet6
,
gateway6
=
gateway6
,
eui64
=
eui64
)
return
client
except
:
return
None
class
ClientFileHandler
(
pyinotify
.
ProcessEvent
):
def
__init__
(
self
,
server
):
...
...
@@ -245,7 +249,10 @@ class Client(object):
class
Subnet
(
object
):
def
__init__
(
self
,
net
=
None
,
gw
=
None
,
dev
=
None
):
if
isinstance
(
net
,
str
):
self
.
net
=
IPy
.
IP
(
net
)
try
:
self
.
net
=
IPy
.
IP
(
net
)
except
:
raise
Exception
else
:
self
.
net
=
net
self
.
gw
=
gw
...
...
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