summaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/config
diff options
context:
space:
mode:
authorHitoshi Irino <irino@sfc.wide.ad.jp>2019-06-24 00:39:22 +0900
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2019-07-02 11:40:22 +0900
commit2f5a4d59cb8d494bcf1a64d45d84bcd8fd4a7f06 (patch)
tree130afc174fe85d32abe3ad4994aecec3461ffcc4 /internal/pkg/config
parent9f936065a907639661eca3924f0a8f09d94abbfe (diff)
BGP connection on a speecified interface (including which is associated VRF) using syscall SO_BINDTODEVICE
Diffstat (limited to 'internal/pkg/config')
-rw-r--r--internal/pkg/config/bgp_configs.go11
-rw-r--r--internal/pkg/config/util.go7
2 files changed, 15 insertions, 3 deletions
diff --git a/internal/pkg/config/bgp_configs.go b/internal/pkg/config/bgp_configs.go
index 37fe1b39..0e375619 100644
--- a/internal/pkg/config/bgp_configs.go
+++ b/internal/pkg/config/bgp_configs.go
@@ -2548,6 +2548,10 @@ type TransportState struct {
// Remote port being used by the peer for the TCP session
// supporting the BGP session.
RemotePort uint16 `mapstructure:"remote-port" json:"remote-port,omitempty"`
+ // original -> bgp:bind-interface
+ // bgp:bind-interface's original type is union.
+ // Interface name for binding.
+ BindInterface string `mapstructure:"bind-interface" json:"bind-interface,omitempty"`
}
// struct for container bgp:config.
@@ -2580,6 +2584,10 @@ type TransportConfig struct {
// original -> gobgp:ttl
// TTL value for BGP packets.
Ttl uint8 `mapstructure:"ttl" json:"ttl,omitempty"`
+ // original -> bgp:bind-interface
+ // bgp:bind-interface's original type is union.
+ // Interface name for binding.
+ BindInterface string `mapstructure:"bind-interface" json:"bind-interface,omitempty"`
}
func (lhs *TransportConfig) Equal(rhs *TransportConfig) bool {
@@ -2604,6 +2612,9 @@ func (lhs *TransportConfig) Equal(rhs *TransportConfig) bool {
if lhs.Ttl != rhs.Ttl {
return false
}
+ if lhs.BindInterface != rhs.BindInterface {
+ return false
+ }
return true
}
diff --git a/internal/pkg/config/util.go b/internal/pkg/config/util.go
index 78a0e713..f85e9376 100644
--- a/internal/pkg/config/util.go
+++ b/internal/pkg/config/util.go
@@ -534,9 +534,10 @@ func NewPeerFromConfigStruct(pconf *Neighbor) *api.Peer {
LocalRestarting: pconf.GracefulRestart.State.LocalRestarting,
},
Transport: &api.Transport{
- RemotePort: uint32(pconf.Transport.Config.RemotePort),
- LocalAddress: localAddress,
- PassiveMode: pconf.Transport.Config.PassiveMode,
+ RemotePort: uint32(pconf.Transport.Config.RemotePort),
+ LocalAddress: localAddress,
+ PassiveMode: pconf.Transport.Config.PassiveMode,
+ BindInterface: pconf.Transport.Config.BindInterface,
},
AfiSafis: afiSafis,
}