What's new

udhcpc startup config

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Its working great and pulled an ip


Untitled.png
 
I could set the client id with the gui
but need to add option 60 so would prefer to just have them all done at the same time
 
Now on to my final ocd..

secure_mode=no
friendly_name=RouterName

atm im doing this via jffs but would love to do it via

services.c

fancy helping :p
 
I could set the client id with the gui
but need to add option 60 so would prefer to just have them all done at the same time
That makes sense. I would be wary that someone might enter a clientid in the GUI (even by accident) which would result in the following command:
Code:
udhcpc -i eth0 -p /var/run/udhcpc0.pid -s /tmp/udhcpc -x 61:hex -x 60:hex -O33 -O249 -x 61:hex

Personally, to maintain the most compatibility/flexibility, I would hard-code option 60 (because almost everything ignores it anyway) and use the GUI to set option 61. (Looking at the code there might be issues with dual-wan setups if it's hard-coded)

If you hard-code both values you might want to consider disabling/removing the code that sets option 61 from the GUI. But I suppose it depends on how you intend to use the router in the future.
 
I tried this yesterday with upnpd

services.c Line 2901

fprintf(f,
"ext_ifname=%s\n"
"listening_ip=%s/%s\n"
"port=%d\n"
"enable_upnp=%s\n"
"enable_natpmp=%s\n"
"secure_mode=%s\n"
"upnp_forward_chain=FUPNP\n"
"upnp_nat_chain=VUPNP\n"
"notify_interval=%d\n"
"system_uptime=yes\n"
"friendly_name=%s\n"
"model_number=%s.%s\n"
"serial=%s\n"
"\n"

fprintf(f,
"ext_ifname=%s\n"
"listening_ip=%s/%s\n"
"port=%d\n"
"enable_upnp=%s\n"
"enable_natpmp=%s\n"
"secure_mode=no"
"upnp_forward_chain=FUPNP\n"
"upnp_nat_chain=VUPNP\n"
"notify_interval=%d\n"
"system_uptime=yes\n"
"friendly_name=DesiredName"
"model_number=%s.%s\n"
"serial=%s\n"
"\n"

it resulted in upnpd not starting
 
just tried resulted in non working upnp due to config being 0 bytes

fprintf(f,
"ext_ifname=%s\n"
"listening_ip=%s/%s\n"
"port=%d\n"
"enable_upnp=%s\n"
"enable_natpmp=%s\n"
"secure_mode=no\n"
"upnp_forward_chain=FUPNP\n"
"upnp_nat_chain=VUPNP\n"
"notify_interval=%d\n"
"system_uptime=yes\n"
"friendly_name=DesiredName\n"
"model_number=%s.%s\n"
"serial=%s\n"
"\n"
 
Code:
fprintf(f,
        "ext_ifname=%s\n"
        "listening_ip=%s/%s\n"
        "port=%d\n"
        "enable_upnp=%s\n"
        "enable_natpmp=%s\n"
        "secure_mode=%s\n"
        "upnp_forward_chain=FUPNP\n"
        "upnp_nat_chain=VUPNP\n"
        "notify_interval=%d\n"
        "system_uptime=yes\n"
        "friendly_name=%s\n"
        "model_number=%s.%s\n"
        "serial=%s\n"
        "\n"
        ,
        get_wan_ifname(wan_primary_ifunit()),
        lanip, lanmask,
        upnp_port,
        upnp_enable ? "yes" : "no",     // upnp enable
        upnp_mnp_enable ? "yes" : "no", // natpmp enable
[B]        "no"                            // force secure_mode (only forward to self)[/B]
        nvram_get_int("upnp_ssdp_interval"),
[B]        "RouterName",                   // force friendly name[/B]
        rt_version, rt_serialno,
        nvram_get("serial_no") ? : et0macaddr
);
 
Last edited:
services.c: In function 'start_wps':
services.c:1593: warning: implicit declaration of function 'get_pid_by_name'
services.c: In function 'stop_misc':
services.c:2652: warning: implicit declaration of function 'stop_acsd'
services.c: In function 'start_upnp':
services.c:2923: error: expected ')' before 'nvram_get_int'
services.c:2927: warning: too few arguments for format
services.c: In function 'start_services':
services.c:3392: warning: implicit declaration of function 'start_nas'
services.c:3432: warning: implicit declaration of function 'start_psta_monitor'
services.c:3441: warning: implicit declaration of function 'start_acsd'
services.c: In function 'stop_services':
services.c:3522: warning: implicit declaration of function 'stop_psta_monitor'
services.c:3555: warning: implicit declaration of function 'stop_nas'
services.c: In function 'handle_notifications':
services.c:4362: warning: implicit declaration of function 'set_wltxpower'
services.c: In function 'dns_filter':
services.c:5856: warning: assignment discards qualifiers from pointer target type
make[4]: *** [services.o] Error 1
make[4]: Leaving directory `/root/asuswrt-merlin/release/src/router/rc'
make[3]: *** [rc] Error 2
make[3]: Leaving directory `/root/asuswrt-merlin/release/src/router'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/root/asuswrt-merlin/release/src-rt-6.x'
make[1]: *** [bin] Error 2
make[1]: Leaving directory `/root/asuswrt-merlin/release/src-rt-6.x'
make: *** [rt-ac66u] Error 2
 
Oops, forgot the comma.
Code:
        get_wan_ifname(wan_primary_ifunit()),
        lanip, lanmask,
        upnp_port,
        upnp_enable ? "yes" : "no",     // upnp enable
        upnp_mnp_enable ? "yes" : "no", // natpmp enable
        [B]"no",                           // force secure_mode (only forward to self)[/B]
        nvram_get_int("upnp_ssdp_interval"),
        [B]"RouterName",                   // force friendly name[/B]
        rt_version, rt_serialno,
        nvram_get("serial_no") ? : et0macaddr
 

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top