Skip to content

Commit

Permalink
Ignore blacklisted interfaces, even if in user specified in mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
tkunicki committed Oct 18, 2022
1 parent 16e06ef commit 0eafff6
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion client/internal/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -863,16 +863,28 @@ func (e *Engine) receiveSignalEvents() {

func (e* Engine) parseNATExternalIPMappings() []string {
var mappedIPs []string
var ignoredIFaces = make(map[string]interface{})
for _, iFace := range(e.config.IFaceBlackList) {
ignoredIFaces[iFace] = nil
}
for _, mapping := range e.config.NATExternalIPs {
var external, internal string
var externalIP, internalIP net.IP
var err error
split := strings.Split(mapping, "/")
if len(split) > 2 {
log.Warnf("ignoring invalid external mapping '%s', too many delimiters", mapping)
break
}
if len(split) > 1 {
internal = split[1]
internalIP = net.ParseIP(internal)
if internalIP == nil {
// not a properly formattted IP address, maybe it's interface name?
// not a properly formatted IP address, maybe it's interface name?
if _, present := ignoredIFaces[internal]; present {
log.Warnf("internal interface '%s' in blacklist, ignoring external mapping '%s'", internal, mapping)
break
}
internalIP, err = findIPFromInterfaceName(internal)
if err != nil {
log.Warnf("error finding interface IP for interface '%s', ignoring external mapping '%s': %v", internal, mapping, err)
Expand Down

0 comments on commit 0eafff6

Please sign in to comment.