372 Commits
Author SHA1 Message Date
Satoshi Fujimoto be2524ee3e config: Use State to get NeighborAddress instead of Config
By introducing dynamic neighbor feature,
GoBGP can have dynamic neighbors,
and corresponding Config.NeighboAddress can be empty.

This patch sets State.NeighborAddress for all neighbors,
and gets the neighbor's address from them.

Signed-off-by: Satoshi Fujimoto <[email protected]>
2017-06-16 09:09:47 +09:00
FUJITA Tomonori d65df0b045 replace github.com/Sirupsen/logrus with github.com/sirupsen/logrus
The usage of "github.com/sirupsen/logrus" is recommended.

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-06-07 21:04:11 +09:00
LamannaandFUJITA Tomonori 52a0f71987 Fix RouteDistinguisher parsing and VPNV6 VRF rib parsing 2017-06-01 12:46:40 +09:00
Chris StocktonandFUJITA Tomonori b529f81ed7 table: reduce allocs in NewDestination
In NewDestination we add additional path to AddrToRadixkey to check
the concrete type of nlri.
2017-05-31 08:37:09 +09:00
FUJITA Tomonori b4831ce8e9 table: avoid unnecessary memory allocation about generating radix key
Signed-off-by: FUJITA Tomonori <[email protected]>
2017-05-23 15:16:35 +09:00
Wataru Ishida 9b9a65d410 *: support replace-peer-as (aka as-override)
we use the term replace-peer-as instead of as-override
since openconfig is using it.

cli

```
$ gobgp n add <neighbor-addr> as <asn> replace-peer-as
```

config

```
neighbor:
  config:
    peer-as: <asn>
    neighbor-address: <neighbor-addr>
  as-path-options:
    config:
      replace-peer-as: true
```

Signed-off-by: Wataru Ishida <[email protected]>
2017-05-10 08:15:00 +00:00
Wataru Ishida 1f053c25c4 *: support remove private as
cli

```
$ gobgp n add <neighbor-addr> as <asn> remove-private-as (all|replace)
```

config

```
neighbor:
  config:
    peer-as: <asn>
    neighbor-address: <neighbor-addr>
    remove-private-as: all
```

Signed-off-by: Wataru Ishida <[email protected]>
2017-05-10 08:05:47 +00:00
Tatsushi DemachiandFUJITA Tomonori ae1da6974a table: Advertise local-pref set by import policy
At importing a path from an external peer, LOCAL_PREF can be set by an
import policy but at exporting a best path to an internal peer, this
learned, calculated LOCAL_PREF is never used and every time overwritten
by a default value 100.

According to RFC 4271 "5.1.5. LOCAL_PREF" and "9.1.1. Phase 1:
Calculation of Degree of Preference", the learned value should be
advertised to other internal peers.

This fixes it by just removing resetting a non-local path's LOCAL_PREF
by the default value.
2017-05-10 15:32:44 +09:00
Wataru Ishida 86d9587f75 cli: speed up showing a specific defined-set
Signed-off-by: Wataru Ishida <[email protected]>
2017-05-06 09:30:10 -04:00
FUJITA Tomonori 738c350a67 server: avoid unnecessary path clone with route server
Signed-off-by: FUJITA Tomonori <[email protected]>
2017-04-27 16:00:54 +09:00
FUJITA Tomonori aa5a115012 table: avoid cloning path for withdraw
when a peer having lots of routes goes down, the cloning paths consume
too much memory.

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-04-27 16:00:54 +09:00
lspgnandFUJITA Tomonori a766d23310 table: Fixed bug when looking up prefixes with a default route. 2017-04-21 17:42:06 +09:00
ISHIDA WataruandFUJITA Tomonori bba54bdaa1 skip asn negotiation for BGP unnumbered peers
since BGP unnumbered peers are typically trusted, skip asn negotiation
for easy configuration.

from configuration file:

```toml
[[neighbors]]
[[neighbors.config]]
neighbor-interface = "eth0"
```

from cli:

```
$ gobgp neighbor add interface eth0
```

Signed-off-by: ISHIDA Wataru <[email protected]>
2017-04-04 22:07:46 +09:00
ISHIDA WataruandFUJITA Tomonori 6f102593b7 table: handle paths with IPv4 NLRI and IPv6 nexthop properly
when a path has IPv4 NLRI and IPv6 nexthop, handle it in MPBGP manner.
(use mp-reach-nlri path attribute instead of nexthop path attibute)

Signed-off-by: ISHIDA Wataru <[email protected]>
2017-04-04 22:07:46 +09:00
ISHIDA WataruandFUJITA Tomonori 6d55ba613a table: fix bug of UpdatePathAttrs() with ipv6 link-local peer
config.Neighbor.Transport.State.LocalAddress may have zone info and
not be valid ip address format.
Use PeerInfo.LocalAddress instead.

Signed-off-by: ISHIDA Wataru <[email protected]>
2017-04-04 22:07:46 +09:00
ISHIDA WataruandFUJITA Tomonori 029852207a server: fix bug of wrongly set <nil> to PeerInfo.LocalAddress
config.TransportState.LocalAddress may have zone info with ipv6 address
like "fe80::x%eth0".
In this case, net.ParseIP() returns <nil>, which leads to set <nil> to
PeerInfo.LocalAddress.

Signed-off-by: ISHIDA Wataru <[email protected]>
2017-04-04 22:07:46 +09:00
FUJITA Tomonori 4284355568 server: fix table query with shorter-prefixes option
$ gobgp g r 168.181.21.128/25 shorter-prefixes
Network not in table
$ gobgp g r 168.181.21.0/25 shorter-prefixes
   Network             Next Hop             AS_PATH              Age       Attrs
*> 168.181.21.0/24     187.16.221.202       61580                04:17:41  [{Origin: i}]

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-03-27 15:37:26 +09:00
Nils JuenemannandGitHub 61240f45b0 Fix for gobgp global rib <ip> 2017-03-21 20:03:24 +01:00
FUJITA Tomonori 448160257e table: handle IPv4-Mapped IPv6 Address as v6
Currently, Prefix structure wrongly handles IPv4-Mapped IPv6 Address
as v4.

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-03-19 23:31:48 +09:00
IWASE Yusuke bd8424e6d5 table/table_manager: Enable to select paths with nexthop
Signed-off-by: IWASE Yusuke <[email protected]>
2017-03-06 09:12:23 +09:00
IWASE Yusuke afcc164d9c table/path: Enable to stringify nexthop reachability
Signed-off-by: IWASE Yusuke <[email protected]>
2017-03-06 09:12:23 +09:00
IWASE Yusuke b10794afcd table: Evaluate best path based on nexthop reachability
For BGP Nexthop Tracking, this patch enables table package to evaluate
the best path based on the nexthop reachability which validated by IGB.

Signed-off-by: IWASE Yusuke <[email protected]>
2017-03-06 09:12:23 +09:00
FUJITA Tomonori e5070a3453 policy: fix prefixset match about different families
currently wrongly try to match prefixset for v4 to v6 routes, and vice versa.

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-02-24 15:15:08 +09:00
FUJITA Tomonori 564c45b90b table: fix DeletePolicyAssignment() crash with bogus input
len(cur)-len(ps) is negative if the caller tries to remove more than
currently assigned policies.

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-02-17 14:04:25 +09:00
ISHIDA WataruandFUJITA Tomonori 52356c26f8 server: add a current option to WatchBestPath()
also, use it for zebra integration

Signed-off-by: ISHIDA Wataru <[email protected]>
2017-02-15 00:10:15 +09:00
ISHIDA WataruandFUJITA Tomonori f276279bf6 table: fix bug of adj-table accepted counter
old filtered value could be POLICY_DIRECTION_IMPORT

Signed-off-by: ISHIDA Wataru <[email protected]>
2017-02-15 00:03:57 +09:00
Wataru Ishida bb42a6832f api: add a UUID field to Path structure
Signed-off-by: Wataru Ishida <[email protected]>
2017-01-22 00:37:58 -05:00
Hiroshi YokoiandFUJITA Tomonori 87e1dd9ea4 policy: avoid crash when getting ext-community 2016-12-15 13:05:56 +09:00
Hiroshi Yokoi ae496021e0 policy: allow using invert condition in statement
Signed-off-by: Hiroshi Yokoi <[email protected]>
2016-12-14 15:28:37 -08:00
Wataru IshidaandFUJITA Tomonori 33ff2fff1f zebra: add flags for recursive nexthop lookup if necessary
Signed-off-by: Wataru Ishida <[email protected]>
2016-11-29 15:45:19 -08:00
Wataru Ishida 9f13bbed20 policy: fix bug of multi policy application
when multiple policies with modification actions are configured, use a path
structure which was applied to the previous policy.

Signed-off-by: Wataru Ishida <[email protected]>
2016-11-25 00:36:27 -05:00
Wataru Ishida f6b384f647 policy: fix bug of rpki validation condition
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 <[email protected]>
2016-11-25 00:33:37 -05:00
Wataru Ishida 93d1dca70a config: simplify route-disposition configuration
before:

```yaml
actions:
    route-disposition:
        accept-route: true
        reject-route: false
```

after

```yaml
action:
    router-disposition: accept-route
```

Signed-off-by: Wataru Ishida <[email protected]>
2016-11-17 23:22:55 -05:00
Wataru Ishida 24e397b0f6 add go vet test
Signed-off-by: Wataru Ishida <[email protected]>
2016-11-17 21:52:20 -05:00
Wataru Ishida 25fe17c817 client: remove server package dependency
move ROA under table package

Signed-off-by: Wataru Ishida <[email protected]>
2016-11-15 07:03:53 +00:00
Wataru Ishida 3f2dd34d37 client: add golang client library
Signed-off-by: Wataru Ishida <[email protected]>
2016-11-14 02:15:45 +00:00
Wataru Ishida b77dc6aa54 policy: fix bug of policy with multiple statements
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 <[email protected]>
2016-11-14 00:58:25 +00:00
FUJITA Tomonori 0ef26666ef table: use old best path instead of withdrawn paths
Preparation for removing in-memory adj-out.

Signed-off-by: FUJITA Tomonori <[email protected]>
2016-11-12 21:21:54 -08:00
Wataru IshidaandFUJITA Tomonori a17832195c support neighbor belongs to VRF
$ gobgp vrf add red rd 100:100 rt both 100:100
$ gobgp neighbor add 10.0.0.1 as 2 vrf red
$ gobgp vrf red neighbor
Peer     AS  Up/Down State       |#Advertised Received Accepted
10.0.0.1 2   never   Active      |          0        0        0

Signed-off-by: Wataru Ishida <[email protected]>
2016-11-04 13:19:47 +09:00
FUJITA Tomonori be9918a163 remove label allocation completely
Signed-off-by: FUJITA Tomonori <[email protected]>
2016-11-03 02:49:59 -07:00
FUJITA Tomonori c7653aa9d4 allow add local route with specific mpls label
Also don't allocate label for local routes. The label management needs
to work with other components rather than bgp.

Signed-off-by: FUJITA Tomonori <[email protected]>
2016-11-03 02:49:59 -07:00
Wataru Ishida 1f4a3192af cli/api: support getting table summary information
$ gobgp global rib summary -a ipv4
$ gobgp neighbor 10.0.0.1 local summary
$ gobgp neighbor 10.0.0.1 adj-in summary
$ gobgp neighbor 10.0.0.1 adj-out summary

Signed-off-by: Wataru Ishida <[email protected]>
2016-10-16 14:07:06 +00:00
Wataru Ishida d46da74d4f policy: support large-community match/action
close #1133

Signed-off-by: Wataru Ishida <[email protected]>
2016-10-10 05:18:17 +00:00
Wataru IshidaandFUJITA Tomonori 2cd0de0139 policy: fix bug of handling multiple prefix-match with same IP prefix.
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 <[email protected]>
2016-10-09 21:57:31 -07:00
Wataru IshidaandFUJITA Tomonori 614746ca11 *: support long lived graceful restart
Signed-off-by: Wataru Ishida <[email protected]>
2016-10-09 07:18:13 -07:00
Vincent BernatandFUJITA Tomonori ddb9303bb5 table: ensure compatibility with archs where int == int32
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-10-08 06:11:08 -07:00
Wataru Ishida cda8d873fa packet/bgp: fix handling of IPv4 mapped IPv6 prefixes
closes #1117

Signed-off-by: Wataru Ishida <[email protected]>
2016-10-04 04:03:46 +00:00
FUJITA Tomonori d79b23967a server: add vrf support to bestpath watch
Signed-off-by: FUJITA Tomonori <[email protected]>
2016-09-30 20:44:12 -07:00
FUJITA Tomonori dfe1b71fd2 api: add id to VrfRequest
to support VRF ID for Zebra Protocol v3.

Signed-off-by: FUJITA Tomonori <[email protected]>
2016-09-30 05:50:25 -07:00
FUJITA Tomonori a042bb3bf8 table: MP_UNREACH_NLRI shouldn't carry any other path attributes
RFC4760 says:

An UPDATE message that contains the MP_UNREACH_NLRI is not required to
carry any other path attributes.

Signed-off-by: FUJITA Tomonori <[email protected]>
2016-09-28 18:35:39 -07:00