Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scapy
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CodeLinaro
public-release-test-restored
platform
external
scapy
Commits
7f82d8d9
Commit
7f82d8d9
authored
7 years ago
by
Pierre LALET
Browse files
Options
Downloads
Patches
Plain Diff
BPF: use conf.default_l2 instead of Ether when type cannot be guessed
parent
12cc3e3a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scapy/arch/bpf/supersocket.py
+9
-9
9 additions, 9 deletions
scapy/arch/bpf/supersocket.py
with
9 additions
and
9 deletions
scapy/arch/bpf/supersocket.py
+
9
−
9
View file @
7f82d8d9
...
...
@@ -7,7 +7,6 @@ Scapy *BSD native support - BPF sockets
from
scapy.config
import
conf
from
scapy.error
import
Scapy_Exception
,
warning
from
scapy.supersocket
import
SuperSocket
from
scapy.layers.l2
import
Ether
from
scapy.layers.inet
import
IP
from
scapy.layers.inet6
import
IPv6
from
scapy.packet
import
Raw
...
...
@@ -121,20 +120,21 @@ class _L2bpfSocket(SuperSocket):
ret
=
fcntl
.
ioctl
(
self
.
ins
,
BIOCGDLT
,
struct
.
pack
(
'
I
'
,
0
))
ret
=
struct
.
unpack
(
'
I
'
,
ret
)[
0
]
except
IOError
as
err
:
warning
(
"
BIOCGDLT failed: unable to guess type. Using Ethernet !
"
)
return
Ether
cls
=
conf
.
default_l2
warning
(
"
BIOCGDLT failed: unable to guess type. Using %s !
"
,
cls
.
name
)
return
cls
# *BSD loopback interface
if
OPENBSD
and
ret
==
12
:
# DTL_NULL on OpenBSD
return
Loopback
# Retrieve the corresponding class
cls
=
conf
.
l2types
.
get
(
ret
,
None
)
if
cls
is
None
:
cls
=
Ether
warning
(
"
Unable to guess type. Using Ethernet !
"
)
return
cls
try
:
return
conf
.
l2types
[
ret
]
except
KeyError
:
cls
=
conf
.
default_l2
warning
(
"
Unable to guess type (type %i). Using %s
"
,
ret
,
cls
.
name
)
def
set_nonblock
(
self
,
set_flag
=
True
):
"""
Set the non blocking flag on the socket
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment