Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bio-rd
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danet
bio-rd
Commits
5e0db242
Commit
5e0db242
authored
4 years ago
by
Oliver Herms
Browse files
Options
Downloads
Patches
Plain Diff
refactoring
parent
20193ab9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
net/tcp/listen.go
+6
-4
6 additions, 4 deletions
net/tcp/listen.go
with
6 additions
and
4 deletions
net/tcp/listen.go
+
6
−
4
View file @
5e0db242
...
...
@@ -78,16 +78,18 @@ func Listen(laddr *net.TCPAddr, ttl uint8) (*Listener, error) {
}
// SetTCPMD5 sets a TCP md5 secret for addr
func
(
l
*
Listener
)
SetTCPMD5
(
a
ddr
net
.
IP
,
secret
string
)
error
{
func
(
l
*
Listener
)
SetTCPMD5
(
peerA
ddr
net
.
IP
,
secret
string
)
error
{
isIPv4Listener
:=
l
.
laddr
.
IP
.
To4
()
!=
nil
isIPv4Client
:=
a
ddr
.
To4
()
!=
nil
isIPv4Client
:=
peerA
ddr
.
To4
()
!=
nil
// Nothing to do if address families don't match
// Do not try to set MD5 secret if listener and peerAddr are of different AFIs.
// Call to setsockopt() would fail with -EINVAL. This is also why we use separate listeners
// per AFI. Tested for you by takt
if
isIPv4Client
!=
isIPv4Listener
{
return
nil
}
return
setTCPMD5Option
(
l
.
fd
,
a
ddr
,
secret
)
return
setTCPMD5Option
(
l
.
fd
,
peerA
ddr
,
secret
)
}
// AcceptTCP accepts a new TCP connection
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment