scapy
scapy copied to clipboard
BGP layer, unable to specify non well-known community via BGPPACommunity
Brief description
Issue 1:
The BGPPACommunity() class limits the community that can be specified to those defined in well_known_communities. It's should be possible to add a community like 64512:11 (0xFC000B)
# http://www.iana.org/assignments/bgp-well-known-communities/bgp-well-known-communities.xml
well_known_communities = {
0xFFFFFF01: "NO_EXPORT", # RFC 1997
0xFFFFFF02: "NO_ADVERTISE", # RFC 1997
0xFFFFFF03: "NO_EXPORT_SUBCONFED", # RFC 1997
0xFFFFFF04: "NOPEER", # RFC 3765
0xFFFF0000: "planned-shut", # draft-francois-bgp-gshut
0xFFFF0001: "ACCEPT-OWN", # RFC 7611
0xFFFF0002: "ROUTE_FILTER_TRANSLATED_v4", # draft-l3vpn-legacy-rtc
0xFFFF0003: "ROUTE_FILTER_v4", # draft-l3vpn-legacy-rtc
0xFFFF0004: "ROUTE_FILTER_TRANSLATED_v6", # draft-l3vpn-legacy-rtc
0xFFFF0005: "ROUTE_FILTER_v6", # draft-l3vpn-legacy-rtc
0xFFFF0006: "LLGR_STALE", # draft-uttaro-idr-bgp-persistence
0xFFFF0007: "NO_LLGR", # draft-uttaro-idr-bgp-persistence
0xFFFF0008: "accept-own-nexthop", # Ashutosh_Grewal
}
class BGPPACommunity(Packet):
"""
Packet handling the COMMUNITIES attribute value.
References: RFC 1997
"""
name = "COMMUNITIES"
fields_desc = [IntEnumField("community", 0, well_known_communities)]
Issue 2:
Cannot specify multiple instances of BGPPACommunity(), which is possible for BGPPAExtCommunity() via BGPPAExtComms() like this:
BGPPathAttr(
type_flags=226,
type_code=16,
attribute=BGPPAExtComms(
extended_communities=[
BGPPAExtCommunity(
type_high=0,
type_low=2,
value=BGPPAExtCommTwoOctetASSpecific(
global_administrator=64512,
local_administrator=11,
),
),
BGPPAExtCommunity(
type_high=0,
type_low=2,
value=BGPPAExtCommTwoOctetASSpecific(
global_administrator=64512,
local_administrator=21,
),
),
BGPPAExtCommunity(
type_high=0,
type_low=2,
value=BGPPAExtCommTwoOctetASSpecific(
global_administrator=64512,
local_administrator=31,
),
),
],
),
),
Thanks
Scapy version
2.5.0
Python version
3.10.6
Operating system
Linux 5.15.0
Additional environment information
No response
How to reproduce
can't share a reproduction, as the issues described define limitations or missing functionality
Actual result
No response
Expected result
No response
Related resources
No response