From 58f3c9eb1163f10ec0aacf036ffe228b77749e60 Mon Sep 17 00:00:00 2001 From: Nicolas BESNARD Date: Tue, 17 Dec 2024 15:28:15 +0000 Subject: [PATCH] odhcp6c: add new argument option to disable script call MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Problem: odhcp6c call user defined script (or /usr/sbin/odhcp6c-update by default) on every state update. When using ubus event, this feature is not needed. Solution: add a new argument option to disable script call on state update. Signed-off-by: Nicolas BESNARD Signed-off-by: Paul Donald Link: https://github.com/openwrt/odhcp6c/pull/106 Signed-off-by: Álvaro Fernández Rojas --- src/odhcp6c.c | 10 ++++++++-- src/script.c | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/odhcp6c.c b/src/odhcp6c.c index 361de81..e784b56 100644 --- a/src/odhcp6c.c +++ b/src/odhcp6c.c @@ -187,7 +187,7 @@ int main(_unused int argc, char* const argv[]) config_dhcp = config_dhcp_get(); config_dhcp_reset(); - while ((c = getopt(argc, argv, "S::DN:V:P:FB:c:i:r:Ru:Ux:s:kK:t:C:m:Lhedp:fav")) != -1) { + while ((c = getopt(argc, argv, "S::DN:V:P:FB:c:i:r:Ru:Ux:s:EkK:t:C:m:Lhedp:fav")) != -1) { switch (c) { case 'S': config_set_allow_slaac_only((optarg) ? atoi(optarg) : -1); @@ -342,7 +342,12 @@ int main(_unused int argc, char* const argv[]) break; case 's': - script = optarg; + if (script) + script = optarg; + break; + + case 'E': + script = NULL; break; case 'k': @@ -774,6 +779,7 @@ static int usage(void) " -r Options to be requested (comma-separated)\n" " -R Do not request any options except those specified with -r\n" " -s