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

Method m2i

scapy/contrib/bgp.py:1728–1775  ·  view source on GitHub ↗
(self, pkt, m)

Source from the content-addressed store, hash-verified

1726 self.type_from = type_from
1727
1728 def m2i(self, pkt, m):
1729 ret = None
1730 type_high, type_low = self.type_from(pkt)
1731
1732 if type_high == 0x00 or type_high == 0x40:
1733 # Two-Octet AS Specific Extended Community
1734 ret = BGPPAExtCommTwoOctetASSpecific(m)
1735
1736 elif type_high == 0x01 or type_high == 0x41:
1737 # IPv4 Address Specific
1738 ret = BGPPAExtCommIPv4AddressSpecific(m)
1739
1740 elif type_high == 0x02 or type_high == 0x42:
1741 # Four-octet AS Specific Extended Community
1742 ret = BGPPAExtCommFourOctetASSpecific(m)
1743
1744 elif type_high == 0x03 or type_high == 0x43:
1745 # Opaque
1746 ret = BGPPAExtCommOpaque(m)
1747
1748 elif type_high == 0x80:
1749 # FlowSpec
1750 if type_low == 0x06:
1751 ret = BGPPAExtCommTrafficRate(m)
1752 elif type_low == 0x07:
1753 ret = BGPPAExtCommTrafficAction(m)
1754 elif type_low == 0x08:
1755 ret = BGPPAExtCommRedirectAS2Byte(m)
1756 elif type_low == 0x09:
1757 ret = BGPPAExtCommTrafficMarking(m)
1758
1759 else:
1760 ret = conf.raw_layer(m)
1761
1762 elif type_high == 0x81:
1763 # FlowSpec
1764 if type_low == 0x08:
1765 ret = BGPPAExtCommRedirectIPv4(m)
1766
1767 elif type_high == 0x82:
1768 # FlowSpec
1769 if type_low == 0x08:
1770 ret = BGPPAExtCommRedirectAS4Byte(m)
1771
1772 else:
1773 ret = conf.raw_layer(m)
1774
1775 return ret
1776
1777
1778class BGPPAIPv6AddressSpecificExtComm(Packet):

Callers

nothing calls this directly

Tested by

no test coverage detected