more versatile solution for adressing

This commit is contained in:
Xavier Henner 2019-07-16 12:55:12 +02:00
parent c941d43ca8
commit d21c8e550a
1 changed files with 6 additions and 1 deletions

View File

@ -215,7 +215,12 @@ func (c *vpnSession) Auth(s *OpenVpnMgt) {
case ok == 0: case ok == 0:
cmd = []string{ cmd = []string{
fmt.Sprintf("client-auth %d %d", c.cID, c.kID), 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 { for _, r := range s.ldap[c.Profile].routes {
cmd = append(cmd, fmt.Sprintf("push \"route %s vpn_gateway\"", r)) cmd = append(cmd, fmt.Sprintf("push \"route %s vpn_gateway\"", r))