summaryrefslogtreecommitdiffhomepage
path: root/table/policy.go
AgeCommit message (Collapse)Author
2017-02-24policy: fix prefixset match about different familiesFUJITA Tomonori
currently wrongly try to match prefixset for v4 to v6 routes, and vice versa. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2017-02-17table: fix DeletePolicyAssignment() crash with bogus inputFUJITA Tomonori
len(cur)-len(ps) is negative if the caller tries to remove more than currently assigned policies. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2016-12-15policy: avoid crash when getting ext-communityHiroshi Yokoi
2016-12-14policy: allow using invert condition in statementHiroshi Yokoi
Signed-off-by: Hiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>
2016-11-25policy: fix bug of multi policy applicationWataru Ishida
when multiple policies with modification actions are configured, use a path structure which was applied to the previous policy. Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
2016-11-25policy: fix bug of rpki validation conditionWataru Ishida
when rpki validation condition is not configured ( c == "" ), don't create an instance for validation. this bug was breaking all policy mechanism when rpki server is configured. Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
2016-11-17config: simplify route-disposition configurationWataru Ishida
before: ```yaml actions: route-disposition: accept-route: true reject-route: false ``` after ```yaml action: router-disposition: accept-route ``` Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
2016-11-17add go vet testWataru Ishida
Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
2016-11-14client: add golang client libraryWataru Ishida
Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
2016-11-14policy: fix bug of policy with multiple statementsWataru Ishida
policy can have multiple statements. In each statement, when condition is matched, route-action is finally evaluated after actions with mods. When route-action is 'none', we contine to next statement if it exists. When route-action is 'accept' or 'reject', we stop proceeding. This patch fixes a bug that route-action can't be set to 'none' which means route-action always be set to 'accept' or 'reject' and can't proceed to the next statement. Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
2016-10-10policy: support large-community match/actionWataru Ishida
close #1133 Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
2016-10-09policy: fix bug of handling multiple prefix-match with same IP prefix.Wataru Ishida
fix handling of prefix-match configuration like below [[defined-sets.prefix-sets]] prefix-set-name = "ps1" [[defined-sets.prefix-sets.prefix-list]] ip-prefix = "0.0.0.0/0" masklength-range = "0..7" [[defined-sets.prefix-sets.prefix-list]] ip-prefix = "0.0.0.0/0" masklength-range = "25..32" Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
2016-10-08table: ensure compatibility with archs where int == int32Vincent Bernat
MED actions are expected to be int64 and AS are expected to be uint32. Use ParseInt/ParseUint instead of Atoi for those until the tests pass on ARM.
2016-08-17policy: fix global default policy initializationISHIDA Wataru
Allow all routes coming in and going out by default Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-08-17policy: support route-type conditionISHIDA Wataru
// match with routes locally generated $ gobgp policy statement s0 add condition route-type local // match with routes received from eBGP peers $ gobgp policy statement s0 add condition route-type external // match with routes received from iBGP peers $ gobgp policy statement s0 add condition route-type internal Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-08-03table: make some RoutingPolicy methods unexportedFUJITA Tomonori
All the exported methods are properly serialized with mutex. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2016-08-03move policyMutex to policy/FUJITA Tomonori
It's more logical. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2016-07-30all logging is done with log.WithFieldsdsp
Signed-off-by: dsp <dsp@2f30.org> Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-07-20remove gRPC dependency from table/FUJITA Tomonori
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2016-07-20table: remove ToApiStruct methods from policy.goFUJITA Tomonori
Preparation for removing gRPC dependency. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2016-05-26policy: add support setting self ip address as next-hopISHIDA Wataru
from configuration file [policy-definitions.statements.actions.bgp-actions] set-next-hop = "self" from cli $ gobgp policy statement stmt1 add action next-hop self Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-05-25policy: add local-pref actionISHIDA Wataru
$ gobgp policy statement st01 add action local-pref 110 Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-04-26policy: don't apply policy when path is withdrawalISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-04-21policy: fix as-path match optimizationISHIDA Wataru
following as-path pattern will be optimized - ^<asn>_ # left-most - _<asn>$ # origin - _<asn>_ # include - ^<asn>$ # only Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-04-21config: add set-next-hop optiontamihiro
2016-04-20policy: check duplicated policy nameISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-04-20policy: don't allow same policy assigned twiceISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-04-20Revert "policy: remove unnecessary regexp special charactor"tamihiro
This reverts commit 76525a966bdfdfd10195e72fffcffbc3a6c69d78.
2016-04-20fix community-set match all evaluation and remove regexp special chars from ↵tamihiro
cli output of community strings
2016-03-31move packet/*.go to packet/bgp/*.go for Go's conventionFUJITA Tomonori
Later, we move non-bgp protocol stuff like mrt under their own direcotries. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2016-03-09policy: fix crash to remove statement from policy without statementsFUJITA Tomonori
https://github.com/osrg/gobgp/issues/754 Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2016-02-19policy: remove unnecessary regexp special charactorISHIDA Wataru
Since communities/ext-communities are tested one by one in policy-condition, we don't need '^' and '$' around match condition items. Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-01-25config: add openconfig identity structs in bgp_configs.goISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-01-16server: reduce number of path.Clone() call to reduce memory footprintISHIDA Wataru
the result of memory profile (500 route-server-clients each of them advertises 100 routes) before: (pprof) top5 3913.02MB of 3978.69MB total (98.35%) Dropped 148 nodes (cum <= 19.89MB) Showing top 10 nodes out of 11 (cum >= 21MB) flat flat% sum% cum cum% 2970.30MB 74.66% 74.66% 2975.80MB 74.79% github.com/osrg/gobgp/server.filterpath 810.09MB 20.36% 95.02% 810.59MB 20.37% github.com/osrg/gobgp/table.(*AdjRib).Update 115.60MB 2.91% 97.92% 119.10MB 2.99% github.com/osrg/gobgp/table.createUpdateMsgFromPath 10MB 0.25% 98.17% 1878.02MB 47.20% github.com/osrg/gobgp/server.(*BgpServer).propagateUpdate 4.50MB 0.11% 98.29% 144.60MB 3.63% github.com/osrg/gobgp/table.CreateUpdateMsgFromPaths after: (pprof) top5 1259.49MB of 1284.27MB total (98.07%) Dropped 175 nodes (cum <= 6.42MB) Showing top 10 nodes out of 26 (cum >= 36.51MB) flat flat% sum% cum cum% 975.81MB 75.98% 75.98% 976.31MB 76.02% github.com/osrg/gobgp/table.(*AdjRib).Update 198.67MB 15.47% 91.45% 208.17MB 16.21% github.com/osrg/gobgp/table.createUpdateMsgFromPath 22MB 1.71% 93.16% 22MB 1.71% github.com/osrg/gobgp/packet.(*IPAddrPrefix).Serialize 20MB 1.56% 94.72% 707.19MB 55.07% github.com/osrg/gobgp/server.(*BgpServer).propagateUpdate 13.50MB 1.05% 95.77% 13.50MB 1.05% github.com/osrg/gobgp/table.NewPath Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-01-16policy: introduce policy option infraISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-01-16table: remove unnecessary copy of path attributesISHIDA Wataru
the result of memory profile (500 route-server-clients each of them advertises 100 routes) before: (pprof) top5 9330.48MB of 9367.53MB total (99.60%) Dropped 157 nodes (cum <= 46.84MB) Showing top 10 nodes out of 17 (cum >= 9334.17MB) flat flat% sum% cum cum% 6163.04MB 65.79% 65.79% 6163.04MB 65.79% github.com/osrg/gobgp/table.NewPath 1155.05MB 12.33% 78.12% 7302.59MB 77.96% github.com/osrg/gobgp/table.(*Path).Clone 986.31MB 10.53% 88.65% 1388.81MB 14.83% github.com/osrg/gobgp/table.(*AdjRib).Update 402.51MB 4.30% 92.95% 402.51MB 4.30% fmt.Sprintf 402.51MB 4.30% 97.24% 402.51MB 4.30% net.parseIPv4 after: (pprof) top 3913.02MB of 3978.69MB total (98.35%) Dropped 148 nodes (cum <= 19.89MB) Showing top 10 nodes out of 11 (cum >= 21MB) flat flat% sum% cum cum% 2970.30MB 74.66% 74.66% 2975.80MB 74.79% github.com/osrg/gobgp/server.filterpath 810.09MB 20.36% 95.02% 810.59MB 20.37% github.com/osrg/gobgp/table.(*AdjRib).Update 115.60MB 2.91% 97.92% 119.10MB 2.99% github.com/osrg/gobgp/table.createUpdateMsgFromPath 10MB 0.25% 98.17% 1878.02MB 47.20% github.com/osrg/gobgp/server.(*BgpServer).propagateUpdate 4.50MB 0.11% 98.29% 144.60MB 3.63% github.com/osrg/gobgp/table.CreateUpdateMsgFromPaths Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-01-10policy: support an action to add origin-validation ext-communityISHIDA Wataru
you can implement https://tools.ietf.org/html/draft-kklf-sidr-route-server-rpki-light-00 by following commands $ gobgp policy statement st0 add condition rpki valid $ gobgp policy statement st0 add action ext-community add valid $ gobgp policy statement st1 add condition rpki not-found $ gobgp policy statement st1 add action ext-community add not-found $ gobgp policy statement st2 add condition rpki invalid $ gobgp policy statement st2 add action ext-community add invalid $ gobgp policy p0 add st0 st1 st2 $ gobgp policy p0 Name p0: StatementName st0: Conditions: RPKI result: valid Actions: ExtCommunity: COMMUNITY_ADD[valid] NONE StatementName st1: Conditions: RPKI result: not-found Actions: ExtCommunity: COMMUNITY_ADD[not-found] NONE StatementName st2: Conditions: RPKI result: invalid Actions: ExtCommunity: COMMUNITY_ADD[invalid] NONE Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-01-10policy: fix NewRpkiValidationConditionFromApiStruct()ISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-01-09config: refactor config structureISHIDA Wataru
- change config variable name to chaincase from camelcase - remove unnecessary wrapper structs which only contain one slice field Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-01-09config: add FromInt() method to config typedefISHIDA Wataru
use for the translation between api structs Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-01-09config: change enum value type to string for ease of configurationISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-01-09tools: avoid adding a new option to bgpyang2golang.py and fix gobgp.yangISHIDA Wataru
pyang has an internal flag "multiple_modules" to handle multiple yang modules. use it instead of introducing a new option --augment also, fix warnings and errors in gobgp.yang which were there but not has been detected for a while due to the usage of --augment. by using "multiple_modules" flag, pyang detected them. most notable error is wrong usage of list, which needs a key in its substatement. this patch adds key to some of them, and for others uses leaf-list instead. Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-01-06policy: remove heavy debug msgISHIDA Wataru
Sprintf() to stringify Fields is heavy Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-12-29config: use viper and support multiple configuration formatsISHIDA Wataru
// toml by default $ gobgpd -f gobgpd.toml // use -t to change configuration type $ gobgpd -t yaml -f gobgpd.yaml Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-12-28config: make config/state variable name simpleISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-12-24policy: fix insufficient nil checkISHIDA Wataru
RouteAction is interface. we have to check the contained value is also nil. Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-12-08server/table: use only one rib for multiple route server clientsISHIDA Wataru
speed up and reduce memory footprint Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-10-24policy: use radix-tree for prefix-list matchingISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-10-24policy: modify path.GetAsSeqList() to insert 0 for non-seq-as-elemsISHIDA Wataru
GetAsSeqList() is used for AsPathSet matching and AsPathPrepend action. Just eliminating non-seq-as-elems from what GetAsSeqList() returns cause wrong results for these two match/action. e.g path A's as-path: {100, 200} 300 currently, action 'as-path-prepend left-most repeat 2' will alter as-path to 300 300 {100, 200} 300, which is not expected behavior. To fix this, insert 0 for non-seq-as-elems. Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-10-24policy: speed up as-path matchingISHIDA Wataru
when matching with single as-path, stop using regexp for speed up Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>