From d21c8e550a891c50d0bf5e0855ef8e3dfbd8358d Mon Sep 17 00:00:00 2001 From: Xavier Henner Date: Tue, 16 Jul 2019 12:55:12 +0200 Subject: [PATCH] more versatile solution for adressing --- vpnsession.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vpnsession.go b/vpnsession.go index 28efcf9..056cbdd 100644 --- a/vpnsession.go +++ b/vpnsession.go @@ -215,7 +215,12 @@ func (c *vpnSession) Auth(s *OpenVpnMgt) { case ok == 0: cmd = []string{ fmt.Sprintf("client-auth %d %d", c.cID, c.kID), - fmt.Sprintf("ifconfig-push %s %s", ip, c.netmask), + } + + if c.netmask == "255.255.255.255" { + cmd = apennd(cmd, fmt.Sprintf("ifconfig-push %s %s", ip, c.localIP)) + } else { + cmd = apennd(cmd, fmt.Sprintf("ifconfig-push %s %s", ip, c.netmask)) } for _, r := range s.ldap[c.Profile].routes { cmd = append(cmd, fmt.Sprintf("push \"route %s vpn_gateway\"", r))