summaryrefslogtreecommitdiffhomepage
path: root/packet/bgp.go
diff options
context:
space:
mode:
Diffstat (limited to 'packet/bgp.go')
-rw-r--r--packet/bgp.go26
1 files changed, 24 insertions, 2 deletions
diff --git a/packet/bgp.go b/packet/bgp.go
index d058d1ec..35e70e72 100644
--- a/packet/bgp.go
+++ b/packet/bgp.go
@@ -3116,11 +3116,11 @@ func (e *TwoOctetAsSpecificExtended) ToApiStruct() *api.ExtendedCommunity {
}
}
-func NewTwoOctetAsSpecificExtended(as uint16, rt uint32, isTransitive bool) *TwoOctetAsSpecificExtended {
+func NewTwoOctetAsSpecificExtended(as uint16, localAdmin uint32, isTransitive bool) *TwoOctetAsSpecificExtended {
return &TwoOctetAsSpecificExtended{
SubType: ExtendedCommunityAttrSubType(EC_SUBTYPE_ROUTE_TARGET),
AS: as,
- LocalAdmin: rt,
+ LocalAdmin: localAdmin,
IsTransitive: isTransitive,
}
}
@@ -3167,6 +3167,19 @@ func (e *IPv4AddressSpecificExtended) ToApiStruct() *api.ExtendedCommunity {
}
}
+func NewIPv4AddressSpecificExtended(ip string, localAdmin uint16, isTransitive bool) *IPv4AddressSpecificExtended {
+ ipv4 := net.ParseIP(ip)
+ if ipv4.To4() == nil {
+ return nil
+ }
+ return &IPv4AddressSpecificExtended{
+ SubType: ExtendedCommunityAttrSubType(EC_SUBTYPE_ROUTE_TARGET),
+ IPv4: ipv4.To4(),
+ LocalAdmin: localAdmin,
+ IsTransitive: isTransitive,
+ }
+}
+
type FourOctetAsSpecificExtended struct {
SubType ExtendedCommunityAttrSubType
AS uint32
@@ -3213,6 +3226,15 @@ func (e *FourOctetAsSpecificExtended) ToApiStruct() *api.ExtendedCommunity {
}
}
+func NewFourOctetAsSpecificExtended(as uint32, localAdmin uint16, isTransitive bool) *FourOctetAsSpecificExtended {
+ return &FourOctetAsSpecificExtended{
+ SubType: ExtendedCommunityAttrSubType(EC_SUBTYPE_ROUTE_TARGET),
+ AS: as,
+ LocalAdmin: localAdmin,
+ IsTransitive: isTransitive,
+ }
+}
+
type OpaqueExtendedValueInterface interface {
Serialize() ([]byte, error)
String() string