Skip to content

Commit

Permalink
Merge pull request #284 from guedou/sessions_fixed
Browse files Browse the repository at this point in the history
Pickling issues fixed
  • Loading branch information
p-l- committed Sep 4, 2016
2 parents 095adbc + 6a3a6cb commit 93767ba
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
6 changes: 4 additions & 2 deletions scapy/layers/inet.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,8 +775,10 @@ def mysummary(self):
conf.l3types.register_num2layer(ETH_P_ALL, IP)


conf.neighbor.register_l3(Ether, IP, lambda l2,l3: getmacbyip(l3.dst))
conf.neighbor.register_l3(Dot3, IP, lambda l2,l3: getmacbyip(l3.dst))
def inet_register_l3(l2, l3):
return getmacbyip(l3.dst)
conf.neighbor.register_l3(Ether, IP, inet_register_l3)
conf.neighbor.register_l3(Dot3, IP, inet_register_l3)


###################
Expand Down
4 changes: 3 additions & 1 deletion scapy/layers/inet6.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,9 @@ def answers(self, other):
return self.payload.answers(other.payload)


conf.neighbor.register_l3(Ether, IPv6, lambda l2,l3: getmacbyip6(l3.dst))
def inet6_register_l3(l2, l3):
return getmacbyip6(l3.dst)
conf.neighbor.register_l3(Ether, IPv6, inet6_register_l3)


class IPerror6(IPv6):
Expand Down
14 changes: 9 additions & 5 deletions scapy/layers/l2.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,10 @@ class LLC(Packet):
XByteField("ssap", 0x00),
ByteField("ctrl", 0) ]

conf.neighbor.register_l3(Ether, LLC, lambda l2,l3: conf.neighbor.resolve(l2,l3.payload))
conf.neighbor.register_l3(Dot3, LLC, lambda l2,l3: conf.neighbor.resolve(l2,l3.payload))
def l2_register_l3(l2, l3):
return conf.neighbor.resolve(l2, l3.payload)
conf.neighbor.register_l3(Ether, LLC, l2_register_l3)
conf.neighbor.register_l3(Dot3, LLC, l2_register_l3)


class CookedLinux(Packet):
Expand All @@ -212,7 +214,7 @@ class SNAP(Packet):
fields_desc = [ X3BytesField("OUI",0x000000),
XShortEnumField("code", 0x000, ETHER_TYPES) ]

conf.neighbor.register_l3(Dot3, SNAP, lambda l2,l3: conf.neighbor.resolve(l2,l3.payload))
conf.neighbor.register_l3(Dot3, SNAP, l2_register_l3)


class Dot1Q(Packet):
Expand Down Expand Up @@ -245,7 +247,7 @@ def mysummary(self):
return self.sprintf("802.1q (%Dot1Q.type%) vlan %Dot1Q.vlan%")


conf.neighbor.register_l3(Ether, Dot1Q, lambda l2,l3: conf.neighbor.resolve(l2,l3.payload))
conf.neighbor.register_l3(Ether, Dot1Q, l2_register_l3)

class STP(Packet):
name = "Spanning Tree Protocol"
Expand Down Expand Up @@ -560,7 +562,9 @@ def mysummary(self):
else:
return self.sprintf("ARP %op% %psrc% > %pdst%")

conf.neighbor.register_l3(Ether, ARP, lambda l2,l3: getmacbyip(l3.pdst))
def l2_register_l3_arp(l2, l3):
return getmacbyip(l3.pdst)
conf.neighbor.register_l3(Ether, ARP, l2_register_l3_arp)

class GRErouting(Packet):
name = "GRE routing informations"
Expand Down
1 change: 0 additions & 1 deletion scapy/route.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
class Route:
def __init__(self):
self.resync()
self.s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.cache = {}

def invalidate_cache(self):
Expand Down

0 comments on commit 93767ba

Please sign in to comment.