summaryrefslogtreecommitdiffhomepage
path: root/packet/bgp
diff options
context:
space:
mode:
authorSatoshi Fujimoto <satoshi.fujimoto7@gmail.com>2017-05-12 10:04:09 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2017-05-23 11:11:10 +0900
commit87fe4fa604fff41c4d930f128e91a58c0fa1ead4 (patch)
treecbcf4289c9831fc4ae86ddd86ce6a0d03f6cd395 /packet/bgp
parent7497ce7eb7e19be757a5b46aeacf11c4271dc1f6 (diff)
cli: Add User Interface for Redirect-IPv6 action
Signed-off-by: Satoshi Fujimoto <satoshi.fujimoto7@gmail.com>
Diffstat (limited to 'packet/bgp')
-rw-r--r--packet/bgp/bgp.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/packet/bgp/bgp.go b/packet/bgp/bgp.go
index 5d924b10..1879d1f0 100644
--- a/packet/bgp/bgp.go
+++ b/packet/bgp/bgp.go
@@ -1258,9 +1258,9 @@ func GetRouteDistinguisher(data []byte) RouteDistinguisherInterface {
}
func parseRdAndRt(input string) ([]string, error) {
- exp := regexp.MustCompile("^((\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)|((\\d+)\\.)?(\\d+)):(\\d+)$")
+ exp := regexp.MustCompile("^((\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)|((\\d+)\\.)?(\\d+)|([\\w]+:[\\w:]*:[\\w]+)):(\\d+)$")
elems := exp.FindStringSubmatch(input)
- if len(elems) != 10 {
+ if len(elems) != 11 {
return nil, fmt.Errorf("failed to parse")
}
return elems, nil
@@ -5759,12 +5759,14 @@ func ParseExtendedCommunity(subtype ExtendedCommunityAttrSubType, com string) (E
if err != nil {
return nil, err
}
- localAdmin, _ := strconv.Atoi(elems[9])
+ localAdmin, _ := strconv.Atoi(elems[10])
ip := net.ParseIP(elems[1])
isTransitive := true
switch {
case ip.To4() != nil:
return NewIPv4AddressSpecificExtended(subtype, elems[1], uint16(localAdmin), isTransitive), nil
+ case ip.To16() != nil:
+ return NewIPv6AddressSpecificExtended(subtype, elems[1], uint16(localAdmin), isTransitive), nil
case elems[6] == "" && elems[7] == "":
asn, _ := strconv.Atoi(elems[8])
return NewTwoOctetAsSpecificExtended(subtype, uint16(asn), uint32(localAdmin), isTransitive), nil