MCPcopy Create free account
hub / github.com/secdev/scapy / getfield

Method getfield

scapy/contrib/bgp.py:288–304  ·  view source on GitHub ↗
(self, pkt, s)

Source from the content-addressed store, hash-verified

286 self.no_length = "length_from" not in kwargs
287
288 def getfield(self, pkt, s):
289 if self.no_length:
290 index = s.find(_BGP_HEADER_MARKER)
291 if index == 0:
292 return s, []
293 if index != -1:
294 self.length_from = lambda pkt: index
295 remain = s[:self.length_from(pkt)] if self.length_from else s
296
297 cls = self.cls_group[
298 detect_add_path_prefix46(remain, self.max_bit_length)
299 ]
300 self.next_cls_cb = lambda *args: cls
301 res = super(BGPNLRIPacketListField, self).getfield(pkt, s)
302 if self.no_length:
303 self.length_from = None
304 return res
305
306
307class _BGPInvalidDataException(Exception):

Callers

nothing calls this directly

Calls 4

detect_add_path_prefix46Function · 0.85
findMethod · 0.80
length_fromMethod · 0.45
getfieldMethod · 0.45

Tested by

no test coverage detected