Skip to content

Conversation

@thehajime
Copy link
Contributor

macOS doesn't set DF-bit by default thus we need an interface to configure the flag.

@kazu-yamamoto
Copy link
Collaborator

Like IPv6Only, this option should be set by default to behave the same among OSes.

@thehajime thehajime force-pushed the feature-sockopt-df branch from 714e97b to beaba43 Compare August 4, 2025 07:04
macOS doesn't set DF-bit by default thus we need an interface to
configure the flag.

Signed-off-by: Hajime Tazaki <[email protected]>
@thehajime thehajime force-pushed the feature-sockopt-df branch from beaba43 to 086ca1b Compare August 4, 2025 07:05
@thehajime
Copy link
Contributor Author

Like IPv6Only, this option should be set by default to behave the same among OSes.

thanks, I've tried to implement it in the updated patches. pls take a lookt at it.

setDontFragment s = when (family == AF_INET) $
#if HAVE_DECL_IP_DONTFRAG || HAVE_DECL_IP_MTU_DISCOVER
setSocketOption s DontFragment 1
#else
Copy link
Collaborator

Choose a reason for hiding this comment

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

These four lines (#else clause) are not necessary

Copy link
Contributor Author

@thehajime thehajime Aug 5, 2025

Choose a reason for hiding this comment

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

if there are OSs/kernels which don't have those sockoption, I guess the compilation fails like below.

Network/Socket/Syscall.hs:138:1: error: [GHC-58481]
    parse error (possibly incorrect indentation or mismatched brackets)
    |
138 | bind :: SocketAddress sa => Socket -> sa -> IO ()
    | ^

I followed the way ipv6only option does in the #else clause to work around this situation.
do you still think it's unnecessary ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Never mind.
I misunderstand that you are using setDontFragment here but you are defining it here.

@kazu-yamamoto kazu-yamamoto self-requested a review August 5, 2025 03:10
Copy link
Collaborator

@kazu-yamamoto kazu-yamamoto left a comment

Choose a reason for hiding this comment

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

LGTM.

@kazu-yamamoto kazu-yamamoto merged commit a8c0a2a into haskell:master Aug 5, 2025
@kazu-yamamoto
Copy link
Collaborator

Merged.
Thanks!

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