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
cddc4799
Commit
cddc4799
authored
Dec 20, 2017
by
m1093782566
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace syscall with sys/unix pkg
parent
f3024879
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
11 deletions
+5
-11
netlink_linux.go
pkg/proxy/ipvs/netlink_linux.go
+5
-11
No files found.
pkg/proxy/ipvs/netlink_linux.go
View file @
cddc4799
...
@@ -21,17 +21,11 @@ package ipvs
...
@@ -21,17 +21,11 @@ package ipvs
import
(
import
(
"fmt"
"fmt"
"net"
"net"
"syscall"
// TODO: replace syscall with golang.org/x/sys/unix?
// The Go doc for syscall says:
// NOTE: This package is locked down.
// Code outside the standard Go repository should be migrated to use the corresponding package in the golang.org/x/sys repository.
// That is also where updates required by new systems or versions should be applied.
// See https://golang.org/s/go1.4-syscall for more information.
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/sets"
"github.com/vishvananda/netlink"
"github.com/vishvananda/netlink"
"golang.org/x/sys/unix"
)
)
type
netlinkHandle
struct
{
type
netlinkHandle
struct
{
...
@@ -55,7 +49,7 @@ func (h *netlinkHandle) EnsureAddressBind(address, devName string) (exist bool,
...
@@ -55,7 +49,7 @@ func (h *netlinkHandle) EnsureAddressBind(address, devName string) (exist bool,
}
}
if
err
:=
h
.
AddrAdd
(
dev
,
&
netlink
.
Addr
{
IPNet
:
netlink
.
NewIPNet
(
addr
)});
err
!=
nil
{
if
err
:=
h
.
AddrAdd
(
dev
,
&
netlink
.
Addr
{
IPNet
:
netlink
.
NewIPNet
(
addr
)});
err
!=
nil
{
// "EEXIST" will be returned if the address is already bound to device
// "EEXIST" will be returned if the address is already bound to device
if
err
==
syscall
.
Errno
(
syscall
.
EEXIST
)
{
if
err
==
unix
.
EEXIST
{
return
true
,
nil
return
true
,
nil
}
}
return
false
,
fmt
.
Errorf
(
"error bind address: %s to interface: %s, err: %v"
,
address
,
devName
,
err
)
return
false
,
fmt
.
Errorf
(
"error bind address: %s to interface: %s, err: %v"
,
address
,
devName
,
err
)
...
@@ -136,9 +130,9 @@ func (h *netlinkHandle) GetLocalAddresses(filterDev string) (sets.String, error)
...
@@ -136,9 +130,9 @@ func (h *netlinkHandle) GetLocalAddresses(filterDev string) (sets.String, error)
}
}
routeFilter
:=
&
netlink
.
Route
{
routeFilter
:=
&
netlink
.
Route
{
Table
:
syscall
.
RT_TABLE_LOCAL
,
Table
:
unix
.
RT_TABLE_LOCAL
,
Type
:
syscall
.
RTN_LOCAL
,
Type
:
unix
.
RTN_LOCAL
,
Protocol
:
syscall
.
RTPROT_KERNEL
,
Protocol
:
unix
.
RTPROT_KERNEL
,
}
}
filterMask
:=
netlink
.
RT_FILTER_TABLE
|
netlink
.
RT_FILTER_TYPE
|
netlink
.
RT_FILTER_PROTOCOL
filterMask
:=
netlink
.
RT_FILTER_TABLE
|
netlink
.
RT_FILTER_TYPE
|
netlink
.
RT_FILTER_PROTOCOL
...
...
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