safesocket, ipn/ipnserver: unify peercred info, fix bug on FreeBSD etc

FreeBSD wasn't able to run "tailscale up" since the recent peercred
refactoring.

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2021-03-02 11:12:14 -08:00
committed by Brad Fitzpatrick
parent f304a45481
commit be779b3587
3 changed files with 14 additions and 15 deletions

View File

@@ -319,6 +319,9 @@ func isReadonlyConn(c net.Conn, logf logger.Logf) bool {
}
const ro = true
const rw = false
if !safesocket.PlatformUsesPeerCreds() {
return rw
}
creds, err := peercred.Get(c)
if err != nil {
logf("connection from unknown peer; read-only")