Skip to content

Comments

Add IPv6 support#26

Open
maxiestudies wants to merge 34 commits intoexaring:masterfrom
maxiestudies:master
Open

Add IPv6 support#26
maxiestudies wants to merge 34 commits intoexaring:masterfrom
maxiestudies:master

Conversation

@maxiestudies
Copy link

Add general documentation about the project and some auto-generated one for the configuration file

maximilianoestudies and others added 26 commits December 17, 2024 14:57
fix bug with the configuration parsing and tests
Add omitempty to yaml, speed up launching probers, start http server early, avoid unsuccessful port bindings
Detect undefined hops in paths
allow empty ip in listen_address
Add support for per path custom labels
Config: Reload config automatically
Config: do not expose internal fields
Improve efficiency of prober.Marshal
@maxiestudies maxiestudies changed the title Add documentation Add IPv6 support Jun 26, 2025
@maxiestudies
Copy link
Author

Current limitation: The source address for the IPv6 packages can't be spoofed.

Comment on lines +21 to +37
`
term DECAP {
from {
destination-address {
10.1.0.255/32;
}
protocol gre;
}
then {
decapsulate gre;
}
}
term ACCEPT {
then accept;
}
}
`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably be a code block with three backticks to improve readability

Comment on lines +39 to +43
`# ip tunnel add gre_decap mode gre local 192.0.2.0 ttl 255
``# echo 1 > /proc/sys/net/ipv4/conf/ip_forwarding
`Necessary if you can’t spoof addresses:
``# echo 1 > /proc/sys/net/ipv4/conf/<input_dev>/accept_local
`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd also recommand using a code block with three backticks here


err = pm.Configure(cfg)
if err != nil {
log.Errorf("reconfiguration failed: %v", err)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this also be fatal or is the service able to start up without a configured prober manager?

Comment on lines +127 to +144
ipVersion := p.cfg.IPVersion

if ipVersion == 4 {
rc, err := newRawSockWrapper()
if err != nil {
return fmt.Errorf("Unable to create rack socket wrapper: %v", err)
}

p.rawConn = rc
}

if ipVersion == 6 {
rc, err := newIPv6RawSockWrapper()
if err != nil {
return fmt.Errorf("Unable to create rack socket wrapper: %v", err)
}

p.rawConn = rc

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this could be more concise

Suggested change
ipVersion := p.cfg.IPVersion
if ipVersion == 4 {
rc, err := newRawSockWrapper()
if err != nil {
return fmt.Errorf("Unable to create rack socket wrapper: %v", err)
}
p.rawConn = rc
}
if ipVersion == 6 {
rc, err := newIPv6RawSockWrapper()
if err != nil {
return fmt.Errorf("Unable to create rack socket wrapper: %v", err)
}
p.rawConn = rc
var rc rawSocket
var err error
switch p.cfg.IPVersion {
case 4:
rc, err = newRawSockWrapper()
case 6:
rc, err = newIPv6RawSockWrapper()
default:
return fmt.Errorf("invalid IP version: %d", p.cfg.IPVersion)
}
if err != nil {
return fmt.Errorf("Unable to create raw socket wrapper: %v", err)
}
p.rawConn = rc

Comment on lines +31 to +42
func (pm *ProberManager) Configure(cfg *config.Config) error {
pm.probersMu.Lock()
defer pm.probersMu.Unlock()

desiredProbers, err := getDesiredProbers(cfg)
if err != nil {
return fmt.Errorf("unable to create probers: %v", err)
}

pm.adjustProbers(desiredProbers)
return nil
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you want to reduce the time the mutex is exclusively locked, consider moving it around the part that actually needs the locking. afaict getDesiredProbers doesn't need any locking

alternatively you can also move the locking into adjustProbers

Suggested change
func (pm *ProberManager) Configure(cfg *config.Config) error {
pm.probersMu.Lock()
defer pm.probersMu.Unlock()
desiredProbers, err := getDesiredProbers(cfg)
if err != nil {
return fmt.Errorf("unable to create probers: %v", err)
}
pm.adjustProbers(desiredProbers)
return nil
}
func (pm *ProberManager) Configure(cfg *config.Config) error {
desiredProbers, err := getDesiredProbers(cfg)
if err != nil {
return fmt.Errorf("unable to create probers: %v", err)
}
pm.probersMu.Lock()
pm.adjustProbers(desiredProbers)
pm.probersMu.Unlock()
return nil
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants