Luiz Buzza
Luiz Buzza

Reputation: 1

How to use AS_PATH attribute in scapy for BGP?

I try to set the AS_PATH attribute:

setAS=BGPPathAttr(type_flags="Transitive", type_code="AS_PATH",attr_len=None,attribute=None)

But Wireshark is saying that it is a malformed AS_PATH attribute.

I already have the other mandatory attributes in my Update message packet and they're doing well.

How to send a BGP Update message crafted packet with correct attributes?

Upvotes: 0

Views: 266

Answers (1)

Luiz Buzza
Luiz Buzza

Reputation: 1

I did like this and works.

setAS = BGPPathAttr(
    type_flags="Transitive",
    type_code="AS_PATH",
    attr_len=None,
    attribute=BGPPAAS4BytesPath(
        segments=BGPPAAS4BytesPath().ASPathSegment(
                                                    segment_type=2(AS_SEQUENCE), segment_length=None, segment_value=[1234]
                                                )
                                )
    )

When we have variables asking the "length", please use "None".

Upvotes: 0

Related Questions