odhcp6c: add failure when -E option is used without ubus support enabled
authorNicolas BESNARD <[email protected]>
Fri, 21 Feb 2025 08:58:17 +0000 (08:58 +0000)
committerÁlvaro Fernández Rojas <[email protected]>
Mon, 3 Nov 2025 15:21:24 +0000 (16:21 +0100)
Problem: The -E option disables the state script and relies only on ubus
to emit events on state changes. But if odhcp6c is compiled without ubus
support (ENABLE_UBUS flag omitted), odhcp6c has no way to signal state
changes.

Solution: Return an error when -E flag is used and ubus support is
absent.

Signed-off-by: Nicolas BESNARD <[email protected]>
Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/106
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
src/odhcp6c.c

index e784b5637e4cd712cab4d99b4d3263404dcc8c84..c36e3e30995f1ffe9efcc2e8cb2e858c55e27097 100644 (file)
@@ -347,6 +347,10 @@ int main(_unused int argc, char* const argv[])
                        break;
 
                case 'E':
+#ifndef WITH_UBUS
+                       syslog(LOG_ERR, "Failed to use ubus event: ENABLE_UBUS compilation flag missing");
+                       return 1;
+#endif /* WITH_UBUS */
                        script = NULL;
                        break;