Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
489e95bc
Commit
489e95bc
authored
Nov 01, 2018
by
kvaps
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set arp_ignore and arp_announce flags
parent
6f897af2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
proxier.go
pkg/proxy/ipvs/proxier.go
+16
-0
No files found.
pkg/proxy/ipvs/proxier.go
View file @
489e95bc
...
...
@@ -171,6 +171,8 @@ const sysctlRouteLocalnet = "net/ipv4/conf/all/route_localnet"
const
sysctlBridgeCallIPTables
=
"net/bridge/bridge-nf-call-iptables"
const
sysctlVSConnTrack
=
"net/ipv4/vs/conntrack"
const
sysctlForward
=
"net/ipv4/ip_forward"
const
sysctlArpIgnore
=
"net/ipv4/conf/all/arp_ignore"
const
sysctlArpAnnounce
=
"net/ipv4/conf/all/arp_announce"
// Proxier is an ipvs based proxy for connections between a localhost:lport
// and services that provide the actual backends.
...
...
@@ -327,6 +329,20 @@ func NewProxier(ipt utiliptables.Interface,
}
}
// Set the arp_ignore sysctl we need for
if
val
,
_
:=
sysctl
.
GetSysctl
(
sysctlArpIgnore
);
val
!=
1
{
if
err
:=
sysctl
.
SetSysctl
(
sysctlArpIgnore
,
1
);
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"can't set sysctl %s: %v"
,
sysctlArpIgnore
,
err
)
}
}
// Set the arp_announce sysctl we need for
if
val
,
_
:=
sysctl
.
GetSysctl
(
sysctlArpAnnounce
);
val
!=
2
{
if
err
:=
sysctl
.
SetSysctl
(
sysctlArpAnnounce
,
2
);
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"can't set sysctl %s: %v"
,
sysctlArpAnnounce
,
err
)
}
}
// Generate the masquerade mark to use for SNAT rules.
masqueradeValue
:=
1
<<
uint
(
masqueradeBit
)
masqueradeMark
:=
fmt
.
Sprintf
(
"%#08x/%#08x"
,
masqueradeValue
,
masqueradeValue
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment