Skip to content

Commit

Permalink
Dont configure server iface if local ip-config is off (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
Doridian authored Feb 21, 2023
1 parent c267f67 commit a11ce41
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client/clients/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (c *Client) registerCommandHandlers() {
if c.doIPConfig {
err = c.iface.Configure(c.remoteNet.GetRawIP(), c.remoteNet, c.remoteNet.GetServerIP())
} else {
err = c.iface.Configure(nil, c.remoteNet, c.remoteNet.GetServerIP())
err = c.iface.Configure(nil, nil, nil)
}
if err != nil {
return err
Expand Down
9 changes: 6 additions & 3 deletions server/servers/main_iface.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,12 @@ func (s *Server) createMainIface() error {

s.ifaceCreationMutex.Unlock()

serverIP := s.VPNNet.GetServerIP()

err = s.mainIface.Configure(serverIP, s.VPNNet, serverIP)
if s.DoLocalIPConfig {
serverIP := s.VPNNet.GetServerIP()
err = s.mainIface.Configure(serverIP, s.VPNNet, serverIP)
} else {
err = s.mainIface.Configure(nil, nil, nil)
}
if err != nil {
return err
}
Expand Down
6 changes: 5 additions & 1 deletion server/servers/sockets.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,11 @@ func (s *Server) serveSocket(w http.ResponseWriter, r *http.Request) {

clientLogger.Printf("Assigned interface %s", localIfaceW.Name())

err = localIface.Configure(s.VPNNet.GetServerIP(), nil, ipClient)
if s.DoLocalIPConfig {
err = localIface.Configure(s.VPNNet.GetServerIP(), nil, ipClient)
} else {
err = localIface.Configure(nil, nil, nil)
}
if err != nil {
clientLogger.Printf("Error configuring interface: %v", err)
return
Expand Down

0 comments on commit a11ce41

Please sign in to comment.