def convert_to_scmp_error(self, addr, class_, type_, pkt, *args, hopbyhop=False, **kwargs): self.addrs.src = addr if self.ext_hdrs: if self.ext_hdrs[0].EXT_TYPE == ExtHopByHopType.SCMP: # Remove any existing SCMP ext header del self.ext_hdrs[0] # Insert SCMP ext at start of headers self.ext_hdrs.insert(0, SCMPExt.from_values(hopbyhop=hopbyhop)) # Trim any extra headers, in the case of SCMPTooManyHopByHop, max+1 as # the SCMP ext header isn't counted. self.ext_hdrs = self.ext_hdrs[:MAX_HOPBYHOP_EXT + 1] # Create SCMP payload. pld = SCMPPayload.from_pkt(class_, type_, pkt, *args, **kwargs) self.l4_hdr = SCMPHeader.from_values(self.addrs.src, self.addrs.dst, class_, type_) self.set_payload(pld)
def _create_extensions(self): return [SCMPExt.from_values(False, False)]
def _create_extensions(self): exts = [] exts.append(TracerouteExt.from_values(5)) exts.append(SCMPExt.from_values(error=False)) return exts
def _create_extensions(self): return [SCMPExt.from_values(True, True)]
def _create_extensions(self): exts = [] exts.append(OneHopPathExt.from_values()) exts.append(SCMPExt.from_values(error=False)) return exts