Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal to bind gRPC API to localhost by default #2669

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/gobgp/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func newRootCmd() *cobra.Command {
},
}

rootCmd.PersistentFlags().StringVarP(&globalOpts.Host, "host", "u", "127.0.0.1", "host")
rootCmd.PersistentFlags().StringVarP(&globalOpts.Host, "host", "u", "::1", "host")
rootCmd.PersistentFlags().IntVarP(&globalOpts.Port, "port", "p", 50051, "port")
rootCmd.PersistentFlags().StringVarP(&globalOpts.Target, "target", "", "", "alternative to host/port when using UDS. Ex: unix:///var/run/go-bgp.sock if running gobgpd with a UDS socket.")
rootCmd.PersistentFlags().BoolVarP(&globalOpts.Json, "json", "j", false, "use json format to output format")
Expand Down
2 changes: 1 addition & 1 deletion cmd/gobgpd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func main() {
Facility string `long:"syslog-facility" description:"specify syslog facility"`
DisableStdlog bool `long:"disable-stdlog" description:"disable standard logging"`
CPUs int `long:"cpus" description:"specify the number of CPUs to be used"`
GrpcHosts string `long:"api-hosts" description:"specify the hosts that gobgpd listens on" default:":50051"`
GrpcHosts string `long:"api-hosts" description:"specify the hosts that gobgpd listens on" default:"[::1]:50051"`
GracefulRestart bool `short:"r" long:"graceful-restart" description:"flag restart-state in graceful-restart capability"`
Dry bool `short:"d" long:"dry-run" description:"check configuration"`
PProfHost string `long:"pprof-host" description:"specify the host that gobgpd listens on for pprof and metrics" default:"localhost:6060"`
Expand Down
4 changes: 3 additions & 1 deletion test/lib/gobgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def __init__(self, name, asn, router_id, ctn_image_name='osrg/gobgp',
def _start_gobgp(self, graceful_restart=False):
c = CmdBuffer()
c << '#!/bin/sh'
c << '/go/bin/gobgpd -f {0}/gobgpd.conf -l {1} -p {2} -t {3} > ' \
c << '/go/bin/gobgpd -f {0}/gobgpd.conf --api-hosts="[::]:50051" -l {1} -p {2} -t {3} > ' \
'{0}/gobgpd.log 2>&1'.format(self.SHARED_VOLUME, self.log_level, '-r' if graceful_restart else '', self.config_format)
cmd = 'echo "{0:s}" > {1}/start.sh'.format(str(c), self.config_dir)
local(cmd, capture=True)
Expand Down Expand Up @@ -153,6 +153,8 @@ def _get_enabled_quagga_daemons(self):
return daemons

def _is_running(self):
print ("Running command gobgp global 2>&1")
print (self.local('gobgp global', capture=True))
return self.local('gobgp global'
' > /dev/null 2>&1; echo $?', capture=True) == '0'

Expand Down