Skip to content

Feature: Add IPv6 support#69

Open
adjivas wants to merge 3 commits into
free5gc:mainfrom
adjivas:ipv6-support
Open

Feature: Add IPv6 support#69
adjivas wants to merge 3 commits into
free5gc:mainfrom
adjivas:ipv6-support

Conversation

@adjivas

@adjivas adjivas commented Aug 11, 2025

Copy link
Copy Markdown

No description provided.

Comment thread pkg/factory/config.go
Comment on lines +147 to +165
if s.BindingIP == "" && s.BindingIPv4 != "" {
s.BindingIP = s.BindingIPv4
}
if s.RegisterIP == "" && s.RegisterIPv4 != "" {
s.RegisterIP = s.RegisterIPv4
}

// Set a default BindingIP/RegisterIP if the Configuration does not provides them
if s.BindingIP == "" && s.RegisterIP == "" {
s.BindingIP = NrfSbiDefaultIP
s.RegisterIP = NrfSbiDefaultIP
} else {
// Complete any missing BindingIP/RegisterIP from RegisterIP/BindingIP
if s.BindingIP == "" {
s.BindingIP = s.RegisterIP
} else if s.RegisterIP == "" {
s.RegisterIP = s.BindingIP
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

How about the following approach? It reduces duplicated values, which helps avoid confusion.

// fallback to IPv4 fields
if s.BindingIP == "" {
	s.BindingIP = s.BindingIPv4
}
if s.RegisterIP == "" {
	s.RegisterIP = s.RegisterIPv4
}

// set defaults / complete missing values
switch {
case s.BindingIP == "" && s.RegisterIP == "":
	s.BindingIP = NrfSbiDefaultIP
	s.RegisterIP = NrfSbiDefaultIP

case s.BindingIP == "":
	s.BindingIP = s.RegisterIP

case s.RegisterIP == "":
	s.RegisterIP = s.BindingIP
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes this look better

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.

2 participants