jech / shncpd Goto Github PK
View Code? Open in Web Editor NEWThe simple, stupid and slow HNCP daemon
License: MIT License
The simple, stupid and slow HNCP daemon
License: MIT License
shncpd -- the simple, stupid and slow HNCP daemon ================================================= shncpd is an implementation of the Home Networking Control Protocol (HNCP) and associated protocols. It currently implements: * DNCP flooding; * prefix and address assignment; * prefix delegation (manually configured); * router advertisement server; * DHCPv4 server. It does not implement routing itself, but relies on babeld. Compiling --------- Compile with one of the following: make or make EXTRA_DEFINES=-DUSE_LIBUBOX LDLIBS=-lubox or make EXTRA_DEFINES=-DUSE_OPENSSL LDLIBS=-lcrypto Running ------- First, run babeld and tell it to redistribute protocol 43: babeld -C 'redistribute local deny' \ -C 'redistribute proto 43 allow' \ eth0 wlan0 Then, run shncpd, passing the list of (internal) Homenet interfaces on the command line: shncpd eth0 wlan0 In order to announce delegated prefixes and name servers, use the -E and -N flags: shncpd -E 2001:db8:42::/48 -N 2001:db8:42::53 \ -E 10.0.0.0/8 \ eth0 wlan0 There is a manual page -- if everything else fails, read the documentation.
I've set it up to run like this:
/usr/bin/shncpd -d 3 -p 8808 -m ff02::8808 -s /usr/lib/shncpd/shncpd-script.sh wlan0 eth0
In the logs I see:
HNCP_DEBUG_LEVEL=3
+ case "$1" in
+ '[' -n '' ']'
Using a DHCP client, DNS and NTP are configured.
Addresses are assigned and routing works.
The main router has OpenWRT CC.
While it does remove it if it is killed, should it not set a lifetime instead?
root@dancer:/git/shncpd# ip -6 addr show eno1/git/shncpd# fg
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
inet6 2601:646:4102:c5::123/128 scope global
valid_lft forever preferred_lft forever
inet6 2601:646:4180:d9f:e4cc:7e3:3277:57a8/128 scope global
valid_lft forever preferred_lft forever
inet6 fe80::eea8:6bff:fefe:9a2/64 scope link
valid_lft forever preferred_lft forever
root@dancer:
shncpd -M wlp2s0 -M eno1 -D
^Croot@dancer:~/git/shncpd# ip -6 addr show eno1
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
inet6 2601:646:4102:c5::123/128 scope global
valid_lft forever preferred_lft forever
inet6 fe80::eea8:6bff:fefe:9a2/64 scope link
valid_lft forever preferred_lft forever
I took shcncpd for a spin yesterday, finding the basic functionality working, only to find this morning
that it was eating 100% of cpu. It is not making a lot of syscalls, one of these goes by every few seconds, but that is certainly not enough to explain the cpu usage. I will try to fire it up again in a debugger to see if I can make it happen again.
sendto(3, "\0\3\0\10\231\212a\370\0\0\0\3\0\4\0\10R\242i\377]{\202\31", 24, 0, {sa_family=AF_INET6, sin6_port=htons(8808), inet_pton(AF_INET6, "ff02::8808", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=if_nametoindex("wlp2s0")}, 28) = 24
socket(PF_LOCAL, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 4
ioctl(4, SIOCGIFINDEX, {ifr_name="wlp2s0", ifr_index=3}) = 0
close(4) = 0
open("/proc/sys/net/ipv6/conf/all/forwarding", O_RDONLY) = 4
read(4, "1\n", 99) = 2
close(4) = 0
rt_sigaction(SIGINT, {SIG_IGN, [], SA_RESTORER, 0x7f2364a6d2f0}, {0x402b16, [], SA_RESTORER, 0x7f2364a6d2f0}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_IGN, [], SA_RESTORER, 0x7f2364a6d2f0}, {SIG_DFL, [], SA_RESTORER, 0x7f2364a6d2f0}, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
clone(child_stack=0, flags=CLONE_PARENT_SETTID|SIGCHLD, parent_tidptr=0x7ffcf738a3ac) = 9824
wait4(9824, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 9824
rt_sigaction(SIGINT, {0x402b16, [], SA_RESTORER, 0x7f2364a6d2f0}, NULL, 8) = 0
rt_sigaction(SIGQUIT, {SIG_DFL, [], SA_RESTORER, 0x7f2364a6d2f0}, NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=9824, si_status=0, si_utime=0, si_stime=0} ---
It is configured on this x86 box as:
d 3632 99.2 0.0 6540 1668 pts/30 R Apr11 806:29 shncpd -D -M wlp2s0
root 3655 0.0 0.0 6540 1940 pts/30 S Apr11 0:02 shncpd -D -M wlp2s0
Elsewhere I have it configured to serve addresses - and it is behaving normally. This is on a pi2:
root 3424 0.0 0.1 1984 1340 ? S 04:01 0:08 shncpd -E fd10::/48 -E 172.26.192.0/20 eth0 wlan0
root 3696 0.0 0.1 1984 1360 ? S 04:05 0:09 shncpd -D -E fd10::/48 -E 172.26.192.0/20 -M wlan0 eth0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.