diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-06-20 14:14:54 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-06-20 15:32:56 +0900 |
commit | a2ce92da546413c7b4e1e9977c4bd6e6fef7a031 (patch) | |
tree | 6282a749332c0e1856d105c1e6ace08476be3da1 /packet/bgp.go | |
parent | bf018a623f8acc70721d1d09f95fd72c2bad6df3 (diff) |
packet: make routeFamilyPrefix public and give a better name
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'packet/bgp.go')
-rw-r--r-- | packet/bgp.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/packet/bgp.go b/packet/bgp.go index b5d5f9f5..e12d7cda 100644 --- a/packet/bgp.go +++ b/packet/bgp.go @@ -1688,7 +1688,7 @@ func GetRouteFamily(name string) (RouteFamily, error) { return RouteFamily(0), fmt.Errorf("%s isn't a valid route family name", name) } -func routeFamilyPrefix(afi uint16, safi uint8) (prefix AddrPrefixInterface, err error) { +func NewPrefixFromRouteFamily(afi uint16, safi uint8) (prefix AddrPrefixInterface, err error) { switch AfiSafiToRouteFamily(afi, safi) { case RF_IPv4_UC, RF_IPv4_MC: prefix = NewIPAddrPrefix(0, "") @@ -2681,7 +2681,7 @@ func (p *PathAttributeMpReachNLRI) DecodeFromBytes(data []byte) error { safi := value[2] p.AFI = afi p.SAFI = safi - _, err = routeFamilyPrefix(afi, safi) + _, err = NewPrefixFromRouteFamily(afi, safi) if err != nil { return NewMessageError(eCode, BGP_ERROR_SUB_ATTRIBUTE_FLAGS_ERROR, data[:p.PathAttribute.Len()], err.Error()) } @@ -2720,7 +2720,7 @@ func (p *PathAttributeMpReachNLRI) DecodeFromBytes(data []byte) error { } value = value[1:] for len(value) > 0 { - prefix, err := routeFamilyPrefix(afi, safi) + prefix, err := NewPrefixFromRouteFamily(afi, safi) if err != nil { return NewMessageError(eCode, BGP_ERROR_SUB_ATTRIBUTE_FLAGS_ERROR, data[:p.PathAttribute.Len()], err.Error()) } @@ -2824,7 +2824,7 @@ func (p *PathAttributeMpUnreachNLRI) DecodeFromBytes(data []byte) error { } afi := binary.BigEndian.Uint16(value[0:2]) safi := value[2] - _, err = routeFamilyPrefix(afi, safi) + _, err = NewPrefixFromRouteFamily(afi, safi) if err != nil { return NewMessageError(eCode, BGP_ERROR_SUB_ATTRIBUTE_FLAGS_ERROR, data[:p.PathAttribute.Len()], err.Error()) } @@ -2832,7 +2832,7 @@ func (p *PathAttributeMpUnreachNLRI) DecodeFromBytes(data []byte) error { p.AFI = afi p.SAFI = safi for len(value) > 0 { - prefix, err := routeFamilyPrefix(afi, safi) + prefix, err := NewPrefixFromRouteFamily(afi, safi) if err != nil { return NewMessageError(eCode, BGP_ERROR_SUB_ATTRIBUTE_FLAGS_ERROR, data[:p.PathAttribute.Len()], err.Error()) } |