Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ebpfCAT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Martin Teichmann
ebpfCAT
Commits
61a751c7
Commit
61a751c7
authored
9 months ago
by
Martin Teichmann
Browse files
Options
Downloads
Patches
Plain Diff
improve resilience to bad input
parent
c119da94
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ebpfcat/ethercat.py
+7
-4
7 additions, 4 deletions
ebpfcat/ethercat.py
with
7 additions
and
4 deletions
ebpfcat/ethercat.py
+
7
−
4
View file @
61a751c7
...
...
@@ -33,6 +33,7 @@ from contextlib import asynccontextmanager
from
enum
import
Enum
,
IntEnum
from
itertools
import
count
import
logging
import
operator
from
random
import
randint
from
socket
import
socket
,
AF_PACKET
,
SOCK_DGRAM
from
struct
import
pack
,
unpack
,
unpack_from
,
calcsize
...
...
@@ -355,7 +356,10 @@ class EtherCat(Protocol):
logging
.
info
(
"
future already done, dropped datagram
"
)
except
CancelledError
:
raise
except
Exception
:
except
Exception
as
e
:
for
_
,
_
,
future
in
dgrams
:
if
not
future
.
done
():
future
.
set_exception
(
e
)
logging
.
exception
(
"
process_packet failed
"
)
raise
...
...
@@ -408,9 +412,8 @@ class EtherCat(Protocol):
out
+=
b
"
\0
"
*
data
elif
data
is
not
None
:
out
+=
data
assert
isinstance
(
pos
,
int
)
and
isinstance
(
offset
,
int
),
\
f
"
pos:
{
pos
}
offset:
{
offset
}
"
self
.
send_queue
.
put_nowait
((
cmd
,
out
,
idx
,
pos
,
offset
,
future
))
self
.
send_queue
.
put_nowait
((
cmd
,
out
,
idx
,
operator
.
index
(
pos
),
operator
.
index
(
offset
),
future
))
ret
=
await
future
if
data
is
None
:
return
unpack
(
fmt
,
ret
)
...
...
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