gravitl / netmaker

Netmaker makes networks with WireGuard. Netmaker automates fast, secure, and distributed virtual networks.
https://netmaker.io
Other
9.18k stars 537 forks source link

[Bug]: Error with join network with freebsd(pfsense) #1508

Open varoudis opened 1 year ago

varoudis commented 1 year ago

Contact Details

No response

What happened?

554 this report is also relevant.

Its still a problem. Any ideas?

Im using netclient-freebsd

[2.5.2-RELEASE][admin@pfSense.stroumfospito.local]/root: /usr/sbin/netclient join -t XXXXXX==
[netclient] 2022-09-02 12:30:48 joining netmain at api.nm.XXXXX.nip.io:443
[netclient] 2022-09-02 12:30:49 network: netmain node pfSensestroumfospitolocal is using port 51821
[netclient] 2022-09-02 12:30:50 error running command: route show default
[netclient] 2022-09-02 12:30:50
[netclient] 2022-09-02 12:30:50 error setting route for netmaker: error getting default route: signal: killed
[netclient] 2022-09-02 12:30:50 network: netmain certificates/key saved
[netclient] 2022-09-02 12:30:50 starting wireguard
[netclient] 2022-09-02 12:30:52 error running command: wg-quick up /etc/netclient/config/nm-netmain.conf
[netclient] 2022-09-02 12:30:52
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x70af9e]

goroutine 32 [running]:
github.com/gravitl/netmaker/netclient/ncutils.RunCmd.func1()
    /home/runner/work/netmaker/netmaker/netclient/ncutils/netclientutils_freebsd.go:42 +0x3e
created by github.com/gravitl/netmaker/netclient/ncutils.RunCmd
    /home/runner/work/netmaker/netmaker/netclient/ncutils/netclientutils_freebsd.go:40 +0x1aa
[2.5.2-RELEASE][admin@pfSense.stroumfospito.local]/root: /usr/sbin/netclient daemon
[netclient] 2022-09-02 12:34:44 [daemon.go-47] Daemon(): netclient daemon started -- version: v0.15.0
[netclient] 2022-09-02 12:34:44 [clientconfig.go-22] UpdateClientConfig(): checking for netclient updates...
[netclient] 2022-09-02 12:34:44 [clientconfig.go-48] UpdateClientConfig(): finished updates
[netclient] 2022-09-02 12:34:44 [mqpublish.go-26] Checkin(): starting checkin goroutine
[netclient] 2022-09-02 12:34:44 [daemon.go-93] startGoRoutines(): initializing network netmain
[netclient] 2022-09-02 12:34:44 [netclientutils_freebsd.go-46] RunCmd(): error running command: wg-quick up /etc/netclient/config/nm-netmain.conf
[netclient] 2022-09-02 12:34:44 [netclientutils_freebsd.go-47] RunCmd():
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x70af9e]

goroutine 18 [running]:
github.com/gravitl/netmaker/netclient/ncutils.RunCmd.func1()
    /home/runner/work/netmaker/netmaker/netclient/ncutils/netclientutils_freebsd.go:42 +0x3e
created by github.com/gravitl/netmaker/netclient/ncutils.RunCmd
    /home/runner/work/netmaker/netmaker/netclient/ncutils/netclientutils_freebsd.go:40 +0x1aa

Version

v0.15.0

What OS are you using?

FreeBSD

Relevant log output

No response

Contributing guidelines

afeiszli commented 1 year ago

@mattkasun @0xdcarns I'm not really sure about this one, but the error comes from here: https://github.com/gravitl/netmaker/blob/release_v0.15.0/netclient/ncutils/netclientutils_freebsd.go#L42

It looks like it's caused by cmd.Process being nil, so we could check for that, but would that be enough? I'm thinking maybe the process already dies before it has a chance to run that command.