Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: telekom-mms/oc-daemon
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: dc028d92d9c392728851d88edfcef8d6219b7577
Choose a base ref
..
head repository: telekom-mms/oc-daemon
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 536536c6f47a64a0aa2e527fb5ee344aae1fa0c8
Choose a head ref
Showing with 12 additions and 10 deletions.
  1. +1 −0 internal/ocrunner/connect.go
  2. +11 −10 internal/splitrt/excludes.go
1 change: 1 addition & 0 deletions internal/ocrunner/connect.go
Original file line number Diff line number Diff line change
@@ -137,6 +137,7 @@ func (c *Connect) savePidFile() {
err = osWriteFile(c.config.PIDFile, []byte(pid), os.FileMode(perm))
if err != nil {
log.WithError(err).Error("OC-Runner writing pid error")
return
}

// set owner and group
21 changes: 11 additions & 10 deletions internal/splitrt/excludes.go
Original file line number Diff line number Diff line change
@@ -45,15 +45,19 @@ func (e *Excludes) setFilter(ctx context.Context) {
setExcludes(ctx, addresses)
}

// prefixFromIPNet returns ipnet as netip.Prefix.
func prefixFromIPNet(ipnet *net.IPNet) netip.Prefix {
addr, _ := netip.AddrFromSlice(ipnet.IP)
bits, _ := ipnet.Mask.Size()
return netip.PrefixFrom(addr.Unmap(), bits)
}

// AddStatic adds a static entry to the split excludes.
func (e *Excludes) AddStatic(ctx context.Context, address *net.IPNet) {
log.WithField("address", address).Debug("SplitRouting adding static exclude")

a, err := netip.ParsePrefix(address.String())
if err != nil {
log.WithError(err).Error("SplitRouting could not parse static exclude")
return
}
// convert address
a := prefixFromIPNet(address)

e.Lock()
defer e.Unlock()
@@ -98,11 +102,8 @@ func (e *Excludes) AddDynamic(ctx context.Context, address *net.IPNet, ttl uint3
"ttl": ttl,
}).Debug("SplitRouting adding dynamic exclude")

prefix, err := netip.ParsePrefix(address.String())
if err != nil {
log.WithError(err).Error("SplitRouting could not parse dynamic exclude")
return
}
// convert address
prefix := prefixFromIPNet(address)
if !prefix.IsSingleIP() {
log.Error("SplitRouting error adding dynamic exclude with multiple IPs")
return