Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[13.4-stable] Naiming backport3 PR 4352 #4377

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/edgeview/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/gorilla/websocket v1.5.0
github.com/grandcat/zeroconf v1.0.0
github.com/lf-edge/eve-api/go v0.0.0-20240829123634-7c8ebda876ff
github.com/lf-edge/eve/pkg/pillar v0.0.0-20240808182004-78201574b04a
github.com/lf-edge/eve/pkg/pillar v0.0.0-20241011162601-efd973923722
github.com/satori/go.uuid v1.2.1-0.20180404165556-75cca531ea76
github.com/shirou/gopsutil v3.21.11+incompatible
github.com/sirupsen/logrus v1.9.3
Expand Down
4 changes: 2 additions & 2 deletions pkg/edgeview/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ github.com/lf-edge/eve-api/go v0.0.0-20240829123634-7c8ebda876ff h1:3uGTOvWQFQkI
github.com/lf-edge/eve-api/go v0.0.0-20240829123634-7c8ebda876ff/go.mod h1:ot6MhAhBXapUDl/hXklaX4kY88T3uC4PTg0D2wD8DzA=
github.com/lf-edge/eve/pkg/kube/cnirpc v0.0.0-20240315102754-0f6d1f182e0d h1:tUBb9M6u42LXwHAYHyh22wJeUUQlTpDkXwRXalpRqbo=
github.com/lf-edge/eve/pkg/kube/cnirpc v0.0.0-20240315102754-0f6d1f182e0d/go.mod h1:Nn3juMJJ1G8dyHOebdZyS4jOB/fuxAd5fIajBaWjHr8=
github.com/lf-edge/eve/pkg/pillar v0.0.0-20240808182004-78201574b04a h1:zFoed+ALAI+Tl2Q56NDSDd8ds85r9ouP3ICvznPg9Kk=
github.com/lf-edge/eve/pkg/pillar v0.0.0-20240808182004-78201574b04a/go.mod h1:OY0o5/pdM7twlZ/MvkDKb2ChoSYpl1+vDuH1GxDXKEQ=
github.com/lf-edge/eve/pkg/pillar v0.0.0-20241011162601-efd973923722 h1:wy0+46dsTULgAqVMmumzT1i2HVSMXSWeT76DuR+Il0M=
github.com/lf-edge/eve/pkg/pillar v0.0.0-20241011162601-efd973923722/go.mod h1:5zB+wlsiTBE2N/Jb0Zr7DaUJMG2OCcAP6X+dyftIdzo=
github.com/miekg/dns v1.1.27/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM=
github.com/miekg/dns v1.1.43 h1:JKfpVSCB84vrAmHzyrsxB5NAr5kLoMXZArPSw7Qlgyg=
github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4=
Expand Down
29 changes: 13 additions & 16 deletions pkg/edgeview/src/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func doAppNet(status, appstr string, isSummary bool) string {
}

fmt.Printf("\n = bridge: %s, VIF: %s, VIF IP: %v, VIF MAC: %s\n",
item.Bridge, item.Vif, item.AllocatedIPv4Addr, item.Mac)
item.Bridge, item.Vif, item.AssignedAddresses.IPv4Addrs, item.Mac)

for _, portLL := range niStatus.Ports {
var portIPs []net.IP
Expand All @@ -205,23 +205,18 @@ func doAppNet(status, appstr string, isSummary bool) string {
continue
}

var appIP string
if item.AllocatedIPv4Addr != nil {
appIP = item.AllocatedIPv4Addr.String()
var appIP []string
for _, assignedip := range item.AssignedAddresses.IPv4Addrs {
appIP = append(appIP, assignedip.Address.String())
}
appMAC := item.Mac.String()

if appIP != "" {
printColor("\n - ping app ip address: "+appIP, colorRED)
pingIPHost(appIP, "")
if len(appIP) > 0 {
joinedAppIPs := strings.Join(appIP, ", ")
printColor("\n - ping app ip address: "+joinedAppIPs, colorRED)
}

if niStatus.Type != types.NetworkInstanceTypeSwitch {
if appIP != "" {
printColor("\n - check open ports for "+appIP, colorRED)
// TODO: nmap package
}

files, err := listRecursiveFiles("/run/zedrouter", ".inet")
if err == nil {
printColor("\n - dhcp host file:\n", colorGREEN)
Expand Down Expand Up @@ -255,8 +250,10 @@ func doAppNet(status, appstr string, isSummary bool) string {
}
}

if appIP != "" {
getAppNetTable(appIP, &niStatus)
if len(appIP) > 0 {
for _, ip := range appIP {
getAppNetTable(ip, &niStatus)
}
}
}

Expand Down Expand Up @@ -555,8 +552,8 @@ func getAppIPs(status string) ([]string, uuid.UUID) {
var appIPs []string
appUUID := appStatus.UUIDandVersion.UUID
for _, item := range appStatus.AppNetAdapterList {
if item.AllocatedIPv4Addr != nil {
appIPs = append(appIPs, item.AllocatedIPv4Addr.String())
for _, assignedip := range item.AssignedAddresses.IPv4Addrs {
appIPs = append(appIPs, assignedip.Address.String())
}
}
return appIPs, appUUID
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading