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
0c83f50c
Commit
0c83f50c
authored
Mar 08, 2022
by
Roberto Bonafiglia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added switch case to check netMode
Signed-off-by:
Roberto Bonafiglia
<
roberto.bonafiglia@suse.com
>
parent
2c39febd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
flannel.go
pkg/agent/flannel/flannel.go
+17
-6
No files found.
pkg/agent/flannel/flannel.go
View file @
0c83f50c
...
@@ -103,26 +103,37 @@ func LookupExtInterface(iface *net.Interface, netMode int) (*backend.ExternalInt
...
@@ -103,26 +103,37 @@ func LookupExtInterface(iface *net.Interface, netMode int) (*backend.ExternalInt
}
}
logrus
.
Debugf
(
"The interface %s will be used by flannel"
,
iface
.
Name
)
logrus
.
Debugf
(
"The interface %s will be used by flannel"
,
iface
.
Name
)
if
netMode
==
(
ipv4
+
ipv6
)
||
netMode
==
ipv4
{
switch
netMode
{
case
ipv4
:
ifaceAddr
,
err
=
ip
.
GetInterfaceIP4Addrs
(
iface
)
ifaceAddr
,
err
=
ip
.
GetInterfaceIP4Addrs
(
iface
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"failed to find IPv4 address for interface %s"
,
iface
.
Name
)
return
nil
,
fmt
.
Errorf
(
"failed to find IPv4 address for interface %s"
,
iface
.
Name
)
}
}
logrus
.
Infof
(
"The interface %s with ipv4 address %s will be used by flannel"
,
iface
.
Name
,
ifaceAddr
[
0
])
logrus
.
Infof
(
"The interface %s with ipv4 address %s will be used by flannel"
,
iface
.
Name
,
ifaceAddr
[
0
])
}
else
{
ifacev6Addr
=
append
(
ifacev6Addr
,
nil
)
case
ipv6
:
ifacev6Addr
,
err
=
ip
.
GetInterfaceIP6Addrs
(
iface
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"failed to find IPv6 address for interface %s"
,
iface
.
Name
)
}
logrus
.
Infof
(
"Using dual-stack mode. The ipv6 address %s will be used by flannel"
,
ifacev6Addr
[
0
])
ifaceAddr
=
append
(
ifaceAddr
,
nil
)
ifaceAddr
=
append
(
ifaceAddr
,
nil
)
case
(
ipv4
+
ipv6
)
:
ifaceAddr
,
err
=
ip
.
GetInterfaceIP4Addrs
(
iface
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"failed to find IPv4 address for interface %s"
,
iface
.
Name
)
}
}
logrus
.
Infof
(
"The interface %s with ipv4 address %s will be used by flannel"
,
iface
.
Name
,
ifaceAddr
[
0
])
if
netMode
==
(
ipv4
+
ipv6
)
{
ifacev6Addr
,
err
=
ip
.
GetInterfaceIP6Addrs
(
iface
)
ifacev6Addr
,
err
=
ip
.
GetInterfaceIP6Addrs
(
iface
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"failed to find IPv6 address for interface %s"
,
iface
.
Name
)
return
nil
,
fmt
.
Errorf
(
"failed to find IPv6 address for interface %s"
,
iface
.
Name
)
}
}
logrus
.
Infof
(
"Using dual-stack mode. The ipv6 address %s will be used by flannel"
,
ifacev6Addr
[
0
])
logrus
.
Infof
(
"Using dual-stack mode. The ipv6 address %s will be used by flannel"
,
ifacev6Addr
[
0
])
}
else
{
default
:
ifaceAddr
=
append
(
ifaceAddr
,
nil
)
ifacev6Addr
=
append
(
ifacev6Addr
,
nil
)
ifacev6Addr
=
append
(
ifacev6Addr
,
nil
)
}
}
if
iface
.
MTU
==
0
{
if
iface
.
MTU
==
0
{
return
nil
,
fmt
.
Errorf
(
"failed to determine MTU for %s interface"
,
iface
.
Name
)
return
nil
,
fmt
.
Errorf
(
"failed to determine MTU for %s interface"
,
iface
.
Name
)
}
}
...
...
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