root permissions check and version counter update

This commit is contained in:
2025-11-13 16:04:39 +01:00
parent 766f878a8d
commit 3ad98b8403
3 changed files with 6 additions and 3 deletions

View File

@@ -37,7 +37,7 @@ namespace ColumnLynx::Utils {
}
std::string getVersion() {
return "a0.3";
return "a0.4";
}
unsigned short serverPort() {

View File

@@ -42,8 +42,11 @@ namespace ColumnLynx::Net {
sc.sc_id = ctlInfo.ctl_id;
sc.sc_unit = 0; // utun0 (0 = auto-assign)
if (connect(mFd, (struct sockaddr*)&sc, sizeof(sc)) < 0)
if (connect(mFd, (struct sockaddr*)&sc, sizeof(sc)) < 0) {
if (errno == EPERM)
throw std::runtime_error("connect(AF_SYS_CONTROL) failed: Insufficient permissions (try running as root)");
throw std::runtime_error("connect(AF_SYS_CONTROL) failed: " + std::string(strerror(errno)));
}
// Retrieve actual utun device name
struct sockaddr_storage addr;