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
dc54a8d4
Commit
dc54a8d4
authored
Sep 13, 2016
by
Lukasz Zajaczkowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fix. Incoming UDP packets not reach newly deployed services
parent
2ed490e1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
proxier.go
pkg/proxy/iptables/proxier.go
+21
-0
No files found.
pkg/proxy/iptables/proxier.go
View file @
dc54a8d4
...
@@ -1105,6 +1105,9 @@ func (proxier *Proxier) syncProxyRules() {
...
@@ -1105,6 +1105,9 @@ func (proxier *Proxier) syncProxyRules() {
glog
.
Errorf
(
"can't open %s, skipping this nodePort: %v"
,
lp
.
String
(),
err
)
glog
.
Errorf
(
"can't open %s, skipping this nodePort: %v"
,
lp
.
String
(),
err
)
continue
continue
}
}
if
lp
.
protocol
==
"udp"
{
proxier
.
clearUdpConntrackForPort
(
lp
.
port
)
}
replacementPortsMap
[
lp
]
=
socket
replacementPortsMap
[
lp
]
=
socket
}
// We're holding the port, so it's OK to install iptables rules.
}
// We're holding the port, so it's OK to install iptables rules.
...
@@ -1323,6 +1326,24 @@ func (proxier *Proxier) syncProxyRules() {
...
@@ -1323,6 +1326,24 @@ func (proxier *Proxier) syncProxyRules() {
proxier
.
portsMap
=
replacementPortsMap
proxier
.
portsMap
=
replacementPortsMap
}
}
// Clear UDP conntrack for port or all conntrack entries when port equal zero.
// When a packet arrives, it will not go through NAT table again, because it is not "the first" packet.
// The solution is clearing the conntrack. Known issus:
// https://github.com/docker/docker/issues/8795
// https://github.com/kubernetes/kubernetes/issues/31983
func
(
proxier
*
Proxier
)
clearUdpConntrackForPort
(
port
int
)
{
var
err
error
=
nil
glog
.
V
(
2
)
.
Infof
(
"Deleting conntrack entries for udp connections"
)
if
port
>
0
{
err
=
proxier
.
execConntrackTool
(
"-D"
,
"-p"
,
"udp"
,
"--dport"
,
strconv
.
Itoa
(
port
))
if
err
!=
nil
&&
!
strings
.
Contains
(
err
.
Error
(),
noConnectionToDelete
)
{
glog
.
Errorf
(
"conntrack return with error: %v"
,
err
)
}
}
else
{
glog
.
Errorf
(
"Wrong port number. The port number must be greater than zero"
)
}
}
// Join all words with spaces, terminate with newline and write to buf.
// Join all words with spaces, terminate with newline and write to buf.
func
writeLine
(
buf
*
bytes
.
Buffer
,
words
...
string
)
{
func
writeLine
(
buf
*
bytes
.
Buffer
,
words
...
string
)
{
buf
.
WriteString
(
strings
.
Join
(
words
,
" "
)
+
"
\n
"
)
buf
.
WriteString
(
strings
.
Join
(
words
,
" "
)
+
"
\n
"
)
...
...
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