Skip to content

tools/compat: add root privilege check in ff_ipc_init()#1049

Merged
jfb8856606 merged 1 commit intodevfrom
fix/tools-root-check
Mar 18, 2026
Merged

tools/compat: add root privilege check in ff_ipc_init()#1049
jfb8856606 merged 1 commit intodevfrom
fix/tools-root-check

Conversation

@jfb8856606
Copy link
Contributor

@jfb8856606 jfb8856606 commented Mar 18, 2026

Summary

F-Stack tools (ifconfig, netstat, ipfw, arp, etc.) are DPDK secondary processes and must be run as root. When executed as a non-root user, DPDK uses a per-user runtime directory (/run/user/<uid>/dpdk/) instead of the system-wide /var/run/dpdk/, causing a cryptic and misleading error:

EAL: Cannot open '/run/user/1000/dpdk/rte/config' for rte_mem_config
EAL: FATAL: Cannot init config
EAL: Error - exiting with code: 1
  Cause: Error with EAL initialization

This change adds an explicit root privilege check at the start of ff_ipc_init(), printing a clear and actionable error message before DPDK initialization is attempted.

Change

Add to tools/compat/ff_ipc.c, in ff_ipc_init():

if (getuid() != 0) {
    rte_exit(EXIT_FAILURE, "Error: F-Stack tools must be run as root.\n");
}

Before / After

Before (as non-root):

EAL: Cannot open '/run/user/1000/dpdk/rte/config' for rte_mem_config
EAL: FATAL: Cannot init config
EAL: Error - exiting with code: 1
  Cause: Error with EAL initialization

After (as non-root):

PANIC in ff_ipc_init():
Error: F-Stack tools must be run as root.

Fixes #829.

@jfb8856606 jfb8856606 merged commit c105f32 into dev Mar 18, 2026
7 checks passed
@jfb8856606 jfb8856606 deleted the fix/tools-root-check branch March 18, 2026 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

f-stack tools add root user check

1 participant