summaryrefslogtreecommitdiffhomepage
path: root/packet
diff options
context:
space:
mode:
Diffstat (limited to 'packet')
-rw-r--r--packet/bgp.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/packet/bgp.go b/packet/bgp.go
index 4301d7c1..bdd07911 100644
--- a/packet/bgp.go
+++ b/packet/bgp.go
@@ -797,7 +797,7 @@ func NewRouteDistinguisherIPAddressAS(admin string, assigned uint16) *RouteDisti
DefaultRouteDistinguisher: DefaultRouteDistinguisher{
Type: BGP_RD_IPV4_ADDRESS,
},
- Admin: net.ParseIP(admin),
+ Admin: net.ParseIP(admin).To4(),
Assigned: assigned,
}
}
@@ -3037,6 +3037,15 @@ func (e *TwoOctetAsSpecificExtended) ToApiStruct() *api.ExtendedCommunity {
}
}
+func NewTwoOctetAsSpecificExtended(as uint16, rt uint32, isTransitive bool) *TwoOctetAsSpecificExtended {
+ return &TwoOctetAsSpecificExtended{
+ SubType: ExtendedCommunityAttrSubType(EC_SUBTYPE_ROUTE_TARGET),
+ AS: as,
+ LocalAdmin: rt,
+ IsTransitive: isTransitive,
+ }
+}
+
type IPv4AddressSpecificExtended struct {
SubType ExtendedCommunityAttrSubType
IPv4 net.IP