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
d785379d
Commit
d785379d
authored
Sep 20, 2018
by
ksubrmnn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create unique mac address per endpoint
parent
3da79f5c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
proxier.go
pkg/proxy/winkernel/proxier.go
+12
-1
No files found.
pkg/proxy/winkernel/proxier.go
View file @
d785379d
...
...
@@ -128,12 +128,23 @@ type endpointsInfo struct {
refCount
uint16
}
//Uses mac prefix and IPv4 address to return a mac address
//This ensures mac addresses are unique for proper load balancing
//Does not support IPv6 and returns a dummy mac
func
conjureMac
(
macPrefix
string
,
ip
net
.
IP
)
string
{
if
ip4
:=
ip
.
To4
();
ip4
!=
nil
{
a
,
b
,
c
,
d
:=
ip4
[
0
],
ip4
[
1
],
ip4
[
2
],
ip4
[
3
]
return
fmt
.
Sprintf
(
"%v-%02x-%02x-%02x-%02x"
,
macPrefix
,
a
,
b
,
c
,
d
)
}
return
"02-11-22-33-44-55"
}
func
newEndpointInfo
(
ip
string
,
port
uint16
,
isLocal
bool
)
*
endpointsInfo
{
info
:=
&
endpointsInfo
{
ip
:
ip
,
port
:
port
,
isLocal
:
isLocal
,
macAddress
:
"00:11:22:33:44:55"
,
// Hardcoding to some Random Mac
macAddress
:
conjureMac
(
"02-11"
,
net
.
ParseIP
(
ip
)),
refCount
:
0
,
hnsID
:
""
,
}
...
...
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