secdev / secdev/scapy

BGP layer, unable to specify non well-known community via BGPPACommunity

Open
#4,071 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
12.6k
Forks
2.2k
Avg merge
1d 4h
Merged PRs (30d)
56

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the BGPPACommunity and BGPPAExtComms entry points described in the issue, comparing how standard and extended communities represent repeated values. Determine how arbitrary values such as 64512:11 should be accepted and how multiple BGPPACommunity instances should be represented. Done means both requested forms can be constructed and serialized consistently with the existing BGP attribute behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.