summaryrefslogtreecommitdiff
path: root/examples
AgeCommit message (Collapse)Author
2019-05-16typo fix in commentDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-16udhcpd: support per-client hostnames in static leasesDenys Vlasenko
function old new delta read_staticlease 222 299 +77 add_server_options 92 154 +62 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 139/0) Total: 139 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-21examples/var_service: use "exec sleep 5" instead of "{ sleep 5; exit; }"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-13examples/udhcp/simple.script: fix resolv.conf update if it is a dangling symlinkRolf Eike Beer
If /etc/resolv.conf is a symlink to a tmpfs and the actual file does not already exist, "readlink -f" will not detect it as symlink. Explicitely check for that condition before and touch the file, making the other code work as intended. Signed-off-by: Rolf Eike Beer <eb@emlix.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-05service examples: if iface do not exist, retry upping itDenys Vlasenko
I've had a case of a machine where eth0 was appearing a bit later after the boot, and appearing _downed_. ifplugd then fails to detect "link up". Thus, depending on how service startup ("ip link set dev eth0 up") races with driver initialization, ethernet randomly fails to initialize on boot. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-02-08dhcp service example: rewrite "private network to mask" as case statementDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-02-05dhcp service example: cater for servers hot giving subnet and/or routerDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-02-02service examples: do not respawn supplicant too oftenDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-18service examples: ifplugd -M to prevents frequent respawningDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-15Update examples/udhcp/udhcpd.confDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-10-30examples/udhcp/simple.script: add possibility to use modern "ip"Jiří Prchal
Script uses "ifconfig" only, not up-to-date so much. This patch adds "ip" in condition if exists. Signed-off-by: Jiří Prchal <jiri.prchal@aksignal.cz> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-07-26examples/var_service: add /var/run flag file to ntp.scriptDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-07-03examples/var_service/: use standard logger script, viewer and pager scriptsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-07-03examples/var_service/: use "svc" for service commands, other tweaksDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-06-23examples: update /var/service/getty for Unicode ttysDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-05-20tweak /var/service exampleDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-20examples/shutdown-1.0: an example of reboot which does not signal initDenys Vlasenko
For one, my inits know nothing about the concept of "shutting down the system". Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-16setlogcons: open /dev/ttyN for "setlogcons N", not /dev/tty1Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-13udhcp: support string user options, closes 10946Denys Vlasenko
function old new delta udhcp_str2optset 536 628 +92 packed_usage 32757 32760 +3 udhcpc_main 2708 2692 -16 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 95/-16) Total: 79 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-03-30examples/var_service: new example: dnsmasq serviceDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-03-30svok: new applet (daemontools compat)Denys Vlasenko
function old new delta svok_main - 127 +127 packed_usage 32705 32757 +52 applet_names 2756 2761 +5 applet_main 1588 1592 +4 bb_banner 46 47 +1 sv 1286 1284 -2 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 4/1 up/down: 189/-2) Total: 187 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-03-30ifplugd service example: always run up/down script on startupDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-03-10udhcpd: fix "not dying on SIGTERM"Denys Vlasenko
Fixes: commit 52a515d18724bbb34e3ccbbb0218efcc4eccc0a8 "udhcp: use poll() instead of select()" Feb 16 2017 udhcp_sp_read() is meant to check whether signal pipe indeed has some data to read. In the above commit, it was changed as follows: - if (!FD_ISSET(signal_pipe.rd, rfds)) + if (!pfds[0].revents) return 0; The problem is, the check was working for select() purely by accident. Caught signal interrupts select()/poll() syscalls, they return with EINTR (regardless of SA_RESTART flag in sigaction). _Then_ signal handler is invoked. IOW: they can't see any changes to fd state caused by signal haldler (in our case, signal handler makes signal pipe ready to be read). For select(), it means that rfds[] bit array is unmodified, bit of signal pipe's read fd is still set, and the above check "works": it thinks select() says there is data to read. This accident does not work for poll(): .revents stays clear, and we do not try reading signal pipe as we should. In udhcpd, we fall through and block in socket read. Further SIGTERM signals simply cause socket read to be interrupted and then restarted (since SIGTERM handler has SA_RESTART=1). Fixing this as follows: remove the check altogether. Set signal pipe read fd to nonblocking mode. Always read it in udhcp_sp_read(). If read fails, assume it's EAGAIN and return 0 ("no signal seen"). udhcpd avoids reading signal pipe on every recvd packet by looping if EINTR (using safe_poll()) - thus ensuring we have correct .revents for all fds - and calling udhcp_sp_read() only if pfds[0].revents!=0. udhcpc performs much fewer reads (typically it sleeps >99.999% of the time), there is no need to optimize it: can call udhcp_sp_read() after each poll unconditionally. To robustify socket reads, unconditionally set pfds[1].revents=0 in udhcp_sp_fd_set() (which is before poll), and check it before reading network socket in udhcpd. TODO: This might still fail: if pfds[1].revents=POLLIN, socket read may still block. There are rare cases when select/poll indicates that data can be read, but then actual read still blocks (one such case is UDP packets with wrong checksum). General advise is, if you use a poll/select loop, keep all your fds nonblocking. Maybe we should also do that to our network sockets? function old new delta udhcp_sp_setup 55 65 +10 udhcp_sp_fd_set 54 60 +6 udhcp_sp_read 46 36 -10 udhcpd_main 1451 1437 -14 udhcpc_main 2723 2708 -15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/3 up/down: 16/-39) Total: -23 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-27tweak examples/var_service/*Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-15fix more instances of ": $((a++))" in shell scriptsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-17Spelling fixes in comments, documentation, tests and examplesDenys Vlasenko
By klemens <ka7@github.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-06examples: make udhcpc script handle /32 netmasksDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-24remove "local" bashism from a few scriptsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-03README_distro_proposal.txt: typo fixesTito Ragusa
Signed-off-by: Tito Ragusa <farmatito@tiscali.it> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-12-25Update to examples/var_service/README_distro_proposal.txtDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-12-09mdev.conf: rename hw_random to hwrngMike Frysinger
The kernel broke the name years ago, but didn't notice until it was much too late. Rename the node to match expectations of userland software, and what the kernel itself documents in its Kconfig help: This provides a device that's usually called /dev/hwrng, ... URL: https://marc.info/?l=linux-crypto-vger&m=144249767024990&w=2 Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2016-12-03README_distro_proposal.txt: writeup about runit adoptionDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-14examples: update var_service/README againDenys Vlasenko
Added "ps -AH e" example Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-14typo fixes in docDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-14examples: update var_service/README againDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-14examples: update var_service/READMEDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-03examples: add example of a DHCP serverDenys Vlasenko
As usual, by multiplying directories - "dhcpd_eth0", "dhcpd_wlan1" you can run many servers on different interfaces. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-26examples: wpa_supplicant.conf has a wrong field deleted in examplesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-20examples/var_service/supplicant_if: new service exampleDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-07-30service/fw example: do not ruin $if[], use different nameDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-07-25var_service/fw: optionally flush all netdevs; optionally prefer one 0/0 routingDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-07-10examples: add a useful "see abridged log" script for ntpd service exampleDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-04unrpm: clean upMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2016-04-04undeb: clean upMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2015-10-24tweak zcip service exampleDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-24Tweak READMEDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-24update network service examplesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-24New example of a service: examples/var_service/zcip_ifDenys Vlasenko
Zeroconf for IPv4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-15better pinger service exampleDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-04-14build system: make CONFIG_EXTRA_LDFLAGS go to LDFLAGS, not EXTRA_LDFLAGSDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>