MCPcopy Index your code
hub / github.com/secdev/scapy / SourceIP6Field

Class SourceIP6Field

scapy/fields.py:1003–1025  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1001
1002
1003class SourceIP6Field(IP6Field):
1004 def __init__(self, name):
1005 # type: (str) -> None
1006 IP6Field.__init__(self, name, None)
1007
1008 def __findaddr(self, pkt):
1009 # type: (Packet) -> Optional[str]
1010 if conf.route6 is None:
1011 # unused import, only to initialize conf.route
1012 import scapy.route6 # noqa: F401
1013 return pkt.route()[1]
1014
1015 def i2m(self, pkt, x):
1016 # type: (Optional[Packet], Optional[Union[str, Net6]]) -> bytes
1017 if x is None and pkt is not None:
1018 x = self.__findaddr(pkt)
1019 return super(SourceIP6Field, self).i2m(pkt, x)
1020
1021 def i2h(self, pkt, x):
1022 # type: (Optional[Packet], Optional[Union[str, Net6]]) -> str
1023 if x is None and pkt is not None:
1024 x = self.__findaddr(pkt)
1025 return super(SourceIP6Field, self).i2h(pkt, x)
1026
1027
1028class DestIP6Field(IP6Field, DestField):

Callers 2

ARPClass · 0.90
IPv6Class · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected