Allow user to specify socket type per ip-addres#210
Open
k0ekk0ek wants to merge 1 commit intoNLnetLabs:masterfrom
Open
Allow user to specify socket type per ip-addres#210k0ekk0ek wants to merge 1 commit intoNLnetLabs:masterfrom
k0ekk0ek wants to merge 1 commit intoNLnetLabs:masterfrom
Conversation
Listening on both UDP and TCP is likely unwanted behavior when support for XDP lands. Allow the user to configure listening on UDP, TCP or both per ip-address option in preparation. Specifying no socket at all ensures both UDP and TCP are opened, which is the current default behavior, thereby remaining backwards compatible configuration wise.
wcawijngaards
approved these changes
Apr 5, 2022
Member
wcawijngaards
left a comment
There was a problem hiding this comment.
The changes look nice, it allows for more expressive configuration.
| setup_socket_servers(socket, ip); | ||
|
|
||
| if (ip && ip->dev) { | ||
| socket->flags = NSD_BIND_DEVICE; |
Member
There was a problem hiding this comment.
Suggested change
| socket->flags = NSD_BIND_DEVICE; | |
| socket->flags |= NSD_BIND_DEVICE; |
Should this 'or' in the flag, because another flag exists, for OPTIONAL?
Comment on lines
+421
to
+425
| size_t namelen = 0; | ||
| unsigned short udp_port = 0, tcp_port = 0; | ||
|
|
||
| /* not an interface if length exceeds size restrictions */ | ||
| if (!namelen || namelen >= IFNAMSIZ) |
Member
There was a problem hiding this comment.
namelen is always 0, because initialized at 0 on line 421 above.
Comment on lines
+621
to
+622
| if (!setup_if_sockets(ip, ifaddrs)) | ||
| setup_ip_sockets(ip, ifaddrs); |
Member
There was a problem hiding this comment.
So the user can only specify all interface names, or all numeric ip addresses, but not mix them on individual interface config lines? Is that a correct reading of this part, not sure if users would need to do that.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Listening on both UDP and TCP is likely unwanted behavior when support for XDP lands. Allow the user to configure listening on UDP, TCP or both per ip-address option in preparation. Specifying no socket type at all ensures both UDP and TCP are opened, which is the current default behavior, thereby remaining backwards compatible configuration wise.