diff options
author | Nasato Goto <7310510@gmail.com> | 2019-03-24 14:12:04 +0900 |
---|---|---|
committer | Nasato Goto <7310510@gmail.com> | 2019-03-24 14:16:26 +0900 |
commit | ddf9e5572f144ebac031e4128c8e3432470c6ef7 (patch) | |
tree | 092d79d127840620a0e54aac6e70b7af943f035f /internal/pkg/table/path.go | |
parent | 15f0c50a61711c46357d369bbef60016ced7bbb2 (diff) |
table: fix Path.SetLargeCommunities not to set vacant communities value
Diffstat (limited to 'internal/pkg/table/path.go')
-rw-r--r-- | internal/pkg/table/path.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/pkg/table/path.go b/internal/pkg/table/path.go index b6080ffa..92aec66f 100644 --- a/internal/pkg/table/path.go +++ b/internal/pkg/table/path.go @@ -900,6 +900,12 @@ func (path *Path) GetLargeCommunities() []*bgp.LargeCommunity { } func (path *Path) SetLargeCommunities(cs []*bgp.LargeCommunity, doReplace bool) { + if len(cs) == 0 && doReplace { + // clear large communities + path.delPathAttr(bgp.BGP_ATTR_TYPE_LARGE_COMMUNITY) + return + } + a := path.getPathAttr(bgp.BGP_ATTR_TYPE_LARGE_COMMUNITY) if a == nil || doReplace { path.setPathAttr(bgp.NewPathAttributeLargeCommunities(cs)) |