Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
ef0bdc0
rewrite network manager
ym Oct 7, 2025
2f33c08
fix compatibility with new network types
ym Oct 7, 2025
49e28f2
fix: dhcp not working
ym Oct 7, 2025
df0f5ef
fix: default route not set
ym Oct 7, 2025
456ee66
monitor link state using netlink
ym Oct 7, 2025
50469c1
renew dhcp lease on link up
ym Oct 7, 2025
3c83bcf
add missing dhcp client methods
ym Oct 7, 2025
78f0479
fix netmask calculation
ym Oct 7, 2025
45b55fe
fix dhcp6 logger
ym Oct 7, 2025
656df6c
fix deadlocks
ym Oct 7, 2025
b04b148
feat: add sync trace
ym Oct 7, 2025
aef2645
use sync trace to track mutexes to make deadlock analysis easier
ym Oct 7, 2025
17a1561
use any to replace interface{}
ym Oct 8, 2025
d6ebbf4
fix lint error
ym Oct 8, 2025
f452e6b
fix: link addr not updated
ym Oct 8, 2025
abb8c4f
revert to default config if config is invalid
ym Oct 8, 2025
db64c64
init display before network initialization
ym Oct 8, 2025
8449911
Add placeholder to hostname
adamshiervani Oct 8, 2025
638949c
refactor: simplify and fix button rendering logic in network settings
adamshiervani Oct 8, 2025
8310077
send router solicitation
ym Oct 8, 2025
f128343
fix race condition in link manager
ym Oct 8, 2025
8cc7ead
do not sync time multiple times
ym Oct 8, 2025
05f2e5b
fix online state detection
ym Oct 8, 2025
6743db6
fix online state detection
ym Oct 8, 2025
ad0b86c
fix state change detection
ym Oct 8, 2025
97844a8
use reconcile instead of updating addresses and routes individually
ym Oct 8, 2025
b84aa38
Merge branch 'dev' into feat/nmrewrite
ym Oct 9, 2025
52ddc9e
fix: do not apply IPv6 DHCP lease if it's from udhcpc
ym Oct 9, 2025
a9cd36c
fix: update NetworkConfig type in config.go
ym Oct 9, 2025
6ff4f37
show flags on ipv6 network card
ym Oct 10, 2025
579345e
refactor & fix hostname
ym Oct 10, 2025
fe074b2
fix hostname
ym Oct 10, 2025
b3ce961
fix errcheck
ym Oct 10, 2025
e47442d
fix mtu
ym Oct 10, 2025
59b7141
fix lint errors
ym Oct 10, 2025
feec19a
fix ui lint errors
ym Oct 10, 2025
ed90e42
feat: change dhcp client
ym Oct 10, 2025
1f568c9
fix lint errors
ym Oct 10, 2025
bb45be1
fix golang lint errors again
ym Oct 10, 2025
1ad44ed
allow to toggle dhcp client via touchscreen
ym Oct 10, 2025
9cd29a3
delete then add addresses again
ym Oct 10, 2025
22f5ed2
fix possible nil dereference
ym Oct 10, 2025
ece467e
fix: mac address not showing on home screen
ym Oct 10, 2025
403c1f8
fix: ensure symlink to last-crash.log
ym Oct 10, 2025
110790a
fix: switch to no_network_screen if network manager is nil
ym Oct 10, 2025
459dc5c
fix: check if network manager is nil
ym Oct 10, 2025
775b0f1
fix: reset config
ym Oct 10, 2025
02382e4
fix: mDNS options
ym Oct 10, 2025
d02ae06
fix: make timesync non-blocking
ym Oct 10, 2025
ff81768
fix: fix field reference in confparser
ym Oct 10, 2025
a3f7b5e
refactor: rename error dump file
ym Oct 10, 2025
aa9d789
fix: dhcpc button doesnt work
ym Oct 10, 2025
ae77887
fix: symlink direction
ym Oct 10, 2025
aee1a01
fix: symlink handling
ym Oct 10, 2025
8810ed4
fix: error dump directory
ym Oct 11, 2025
bc4c2d9
fix: golangci-lint warnings
ym Oct 11, 2025
76d256b
feat: add CIDR notation support for IPv4 address
ym Oct 11, 2025
5e06625
feat: add copy to clipboard functionality for MAC address in network …
adamshiervani Oct 13, 2025
e38b087
Close Modals on Escape
adamshiervani Oct 13, 2025
aa6f5b4
feat: add DHCP client as a critical field
adamshiervani Oct 13, 2025
b6a1eec
fix: touchscreen dhcp client button
ym Oct 13, 2025
667877f
fix: save config after toggling dhcp client
ym Oct 13, 2025
9b46209
fix: clean up udhcpc processes
ym Oct 13, 2025
710f082
refactor: update ConfirmDialog component styles and icons
adamshiervani Oct 14, 2025
6ff5fb7
feat: implement RebootingOverlay component to handle device reboot
adamshiervani Oct 14, 2025
63d1a68
feat: hide video if there are connectionIssues
adamshiervani Oct 14, 2025
b3141e0
feat: add reboot state management to UI store
adamshiervani Oct 14, 2025
f24ca51
refactor: clean up reboot route
adamshiervani Oct 14, 2025
80ae3f7
Improve network setting UI
adamshiervani Oct 14, 2025
53556cb
feat: add JSONRPC event for reboot notification
adamshiervani Oct 14, 2025
895cd5c
feat: add CORS support for device status endpoint
adamshiervani Oct 14, 2025
1cf7dd4
feat: enhance network change handling and reboot logic
adamshiervani Oct 14, 2025
29b0ac7
fix: correct websocket reconnection logic for legacy signaling
adamshiervani Oct 14, 2025
e7afa12
fix: update expected reboot duration message in RebootingOverlay comp…
adamshiervani Oct 14, 2025
008460d
fix: improve layout of critical changes display in network settings
adamshiervani Oct 14, 2025
c1f1da2
fix: ui tweak
adamshiervani Oct 14, 2025
6a2a33b
fix: ignore DHCP lease if not in DHCP mode
ym Oct 14, 2025
f56f1d9
fix: handle network data fetch errors in settings
adamshiervani Oct 14, 2025
cb56007
fix: remove unused error message
adamshiervani Oct 14, 2025
6be9a10
feat: implement post-reboot action handling for better reboot handling
adamshiervani Oct 14, 2025
132c2f9
refactor: simplify shouldReboot checks
adamshiervani Oct 14, 2025
b6a640f
debug: add console log for reboot state setting
adamshiervani Oct 14, 2025
52dca2b
fix stale closures
adamshiervani Oct 14, 2025
2112fe2
chore: update react-hook-form to version 7.65.0 in package.json and p…
adamshiervani Oct 14, 2025
2f51cba
Hide video overlays if there is a connection issue
adamshiervani Oct 14, 2025
c4c3880
fix: handle optional chaining for address and validation in StaticIpv…
adamshiervani Oct 14, 2025
fc606d0
fix: redirect not working when changing to static IPv4 mode from DHCP
ym Oct 15, 2025
4c0a0c4
chore: cleanup network.go
ym Oct 15, 2025
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
9 changes: 8 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,12 @@
"cva",
"cx"
],
"git.ignoreLimitWarning": true
"gopls": {
"build.buildFlags": [
"-tags",
"synctrace"
]
},
"git.ignoreLimitWarning": true,
"cmake.sourceDirectory": "/workspaces/kvm-static-ip/internal/native/cgo"
}
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ BUILDKIT_FLAVOR := arm-rockchip830-linux-uclibcgnueabihf
BUILDKIT_PATH ?= /opt/jetkvm-native-buildkit
SKIP_NATIVE_IF_EXISTS ?= 0
SKIP_UI_BUILD ?= 0
ENABLE_SYNC_TRACE ?= 0

GO_BUILD_ARGS := -tags netgo,timetzdata,nomsgpack
ifeq ($(ENABLE_SYNC_TRACE), 1)
GO_BUILD_ARGS := $(GO_BUILD_ARGS),synctrace
endif

GO_RELEASE_BUILD_ARGS := -trimpath $(GO_BUILD_ARGS)
GO_LDFLAGS := \
-s -w \
Expand Down
2 changes: 1 addition & 1 deletion cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ func RunWebsocketClient() {
}

// If the network is not up, well, we can't connect to the cloud.
if !networkState.IsOnline() {
if !networkManager.IsOnline() {
cloudLogger.Warn().Msg("waiting for network to be online, will retry in 3 seconds")
time.Sleep(3 * time.Second)
continue
Expand Down
101 changes: 80 additions & 21 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import (
)

const (
envChildID = "JETKVM_CHILD_ID"
errorDumpDir = "/userdata/jetkvm/"
errorDumpStateFile = ".has_error_dump"
errorDumpTemplate = "jetkvm-%s.log"
envChildID = "JETKVM_CHILD_ID"
errorDumpDir = "/userdata/jetkvm/crashdump"
errorDumpLastFile = "last-crash.log"
errorDumpTemplate = "jetkvm-%s.log"
)

func program() {
Expand Down Expand Up @@ -117,49 +117,108 @@ func supervise() error {
return nil
}

func createErrorDump(logFile *os.File) {
logFile.Close()
func isSymlinkTo(oldName, newName string) bool {
file, err := os.Stat(newName)
if err != nil {
return false
}
if file.Mode()&os.ModeSymlink != os.ModeSymlink {
return false
}
target, err := os.Readlink(newName)
if err != nil {
return false
}
return target == oldName
}

// touch the error dump state file
if err := os.WriteFile(filepath.Join(errorDumpDir, errorDumpStateFile), []byte{}, 0644); err != nil {
return
func ensureSymlink(oldName, newName string) error {
if isSymlinkTo(oldName, newName) {
return nil
}
_ = os.Remove(newName)
return os.Symlink(oldName, newName)
}

fileName := fmt.Sprintf(errorDumpTemplate, time.Now().Format("20060102150405"))
filePath := filepath.Join(errorDumpDir, fileName)
if err := os.Rename(logFile.Name(), filePath); err == nil {
fmt.Printf("error dump created: %s\n", filePath)
return
func renameFile(f *os.File, newName string) error {
_ = f.Close()

// try to rename the file first
if err := os.Rename(f.Name(), newName); err == nil {
return nil
}

fnSrc, err := os.Open(logFile.Name())
// copy the log file to the error dump directory
fnSrc, err := os.Open(f.Name())
if err != nil {
return
return fmt.Errorf("failed to open file: %w", err)
}
defer fnSrc.Close()

fnDst, err := os.Create(filePath)
fnDst, err := os.Create(newName)
if err != nil {
return
return fmt.Errorf("failed to create file: %w", err)
}
defer fnDst.Close()

buf := make([]byte, 1024*1024)
for {
n, err := fnSrc.Read(buf)
if err != nil && err != io.EOF {
return
return fmt.Errorf("failed to read file: %w", err)
}
if n == 0 {
break
}

if _, err := fnDst.Write(buf[:n]); err != nil {
return
return fmt.Errorf("failed to write file: %w", err)
}
}

fmt.Printf("error dump created: %s\n", filePath)
return nil
}

func ensureErrorDumpDir() error {
// TODO: check if the directory is writable
f, err := os.Stat(errorDumpDir)
if err == nil && f.IsDir() {
return nil
}
if err := os.MkdirAll(errorDumpDir, 0755); err != nil {
return fmt.Errorf("failed to create error dump directory: %w", err)
}
return nil
}

func createErrorDump(logFile *os.File) {
fmt.Println()

fileName := fmt.Sprintf(
errorDumpTemplate,
time.Now().Format("20060102-150405"),
)

// check if the directory exists
if err := ensureErrorDumpDir(); err != nil {
fmt.Printf("failed to ensure error dump directory: %v\n", err)
return
}

filePath := filepath.Join(errorDumpDir, fileName)
if err := renameFile(logFile, filePath); err != nil {
fmt.Printf("failed to rename file: %v\n", err)
return
}

fmt.Printf("error dump copied: %s\n", filePath)

lastFilePath := filepath.Join(errorDumpDir, errorDumpLastFile)

if err := ensureSymlink(filePath, lastFilePath); err != nil {
fmt.Printf("failed to create symlink: %v\n", err)
return
}
}

func doSupervise() {
Expand Down
Loading