Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
safeedge
pyroute2
Commits
d7b124b1
Commit
d7b124b1
authored
Apr 07, 2020
by
Florent Fourcot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conntrack: add some __slots__ attribute to reduce memory usage
parent
c748a223
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
pyroute2/conntrack.py
pyroute2/conntrack.py
+6
-0
pyroute2/netlink/nfnetlink/nfctsocket.py
pyroute2/netlink/nfnetlink/nfctsocket.py
+5
-0
No files found.
pyroute2/conntrack.py
View file @
d7b124b1
...
@@ -9,6 +9,9 @@ from pyroute2.netlink.nfnetlink.nfctsocket import NFCTSocket
...
@@ -9,6 +9,9 @@ from pyroute2.netlink.nfnetlink.nfctsocket import NFCTSocket
class
NFCTATcpProtoInfo
(
object
):
class
NFCTATcpProtoInfo
(
object
):
__slots__
=
(
'state'
,
'wscale_orig'
,
'wscale_reply'
,
'flags_orig'
,
'flags_reply'
)
def
__init__
(
self
,
state
,
wscale_orig
=
None
,
wscale_reply
=
None
,
def
__init__
(
self
,
state
,
wscale_orig
=
None
,
wscale_reply
=
None
,
flags_orig
=
None
,
flags_reply
=
None
):
flags_orig
=
None
,
flags_reply
=
None
):
self
.
state
=
state
self
.
state
=
state
...
@@ -49,6 +52,9 @@ class NFCTATcpProtoInfo(object):
...
@@ -49,6 +52,9 @@ class NFCTATcpProtoInfo(object):
class
ConntrackEntry
(
object
):
class
ConntrackEntry
(
object
):
__slots__
=
(
'tuple_orig'
,
'tuple_reply'
,
'status'
,
'timeout'
,
'protoinfo'
,
'mark'
,
'id'
,
'use'
)
def
__init__
(
self
,
family
,
tuple_orig
,
tuple_reply
,
cta_status
,
def
__init__
(
self
,
family
,
tuple_orig
,
tuple_reply
,
cta_status
,
cta_timeout
,
cta_protoinfo
,
cta_mark
,
cta_id
,
cta_use
):
cta_timeout
,
cta_protoinfo
,
cta_mark
,
cta_id
,
cta_use
):
self
.
tuple_orig
=
NFCTAttrTuple
.
from_netlink
(
family
,
tuple_orig
)
self
.
tuple_orig
=
NFCTAttrTuple
.
from_netlink
(
family
,
tuple_orig
)
...
...
pyroute2/netlink/nfnetlink/nfctsocket.py
View file @
d7b124b1
...
@@ -367,6 +367,11 @@ class NFCTAttr(object):
...
@@ -367,6 +367,11 @@ class NFCTAttr(object):
class
NFCTAttrTuple
(
NFCTAttr
):
class
NFCTAttrTuple
(
NFCTAttr
):
__slots__
=
(
'saddr'
,
'daddr'
,
'proto'
,
'sport'
,
'dport'
,
'icmp_id'
,
'icmp_type'
,
'family'
,
'_attr_ip'
,
'_attr_icmp'
)
def
__init__
(
self
,
family
=
socket
.
AF_INET
,
def
__init__
(
self
,
family
=
socket
.
AF_INET
,
saddr
=
None
,
daddr
=
None
,
proto
=
None
,
sport
=
None
,
dport
=
None
,
saddr
=
None
,
daddr
=
None
,
proto
=
None
,
sport
=
None
,
dport
=
None
,
icmp_id
=
None
,
icmp_type
=
None
,
icmp_code
=
None
):
icmp_id
=
None
,
icmp_type
=
None
,
icmp_code
=
None
):
...
...
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