1 --- a/include/applets.src.h
2 +++ b/include/applets.src.h
3 @@ -266,6 +266,7 @@ IF_MT(APPLET(mt, BB_DIR_BIN, BB_SUID_DRO
4 IF_MV(APPLET(mv, BB_DIR_BIN, BB_SUID_DROP))
5 IF_NAMEIF(APPLET(nameif, BB_DIR_SBIN, BB_SUID_DROP))
6 IF_NC(APPLET(nc, BB_DIR_USR_BIN, BB_SUID_DROP))
7 +IF_NETMSG(APPLET(netmsg, BB_DIR_BIN, BB_SUID_REQUIRE))
8 IF_NETSTAT(APPLET(netstat, BB_DIR_BIN, BB_SUID_DROP))
9 IF_NICE(APPLET(nice, BB_DIR_BIN, BB_SUID_DROP))
10 IF_NOHUP(APPLET(nohup, BB_DIR_USR_BIN, BB_SUID_DROP))
11 --- a/networking/Config.src
12 +++ b/networking/Config.src
13 @@ -612,6 +612,12 @@ config FEATURE_IPCALC_LONG_OPTIONS
15 Support long options for the ipcalc applet.
21 + simple program for sending udp broadcast messages
26 --- a/networking/Kbuild.src
27 +++ b/networking/Kbuild.src
28 @@ -27,6 +27,7 @@ lib-$(CONFIG_IP) += ip.o
29 lib-$(CONFIG_IPCALC) += ipcalc.o
30 lib-$(CONFIG_NAMEIF) += nameif.o
31 lib-$(CONFIG_NC) += nc.o
32 +lib-$(CONFIG_NETMSG) += netmsg.o
33 lib-$(CONFIG_NETSTAT) += netstat.o
34 lib-$(CONFIG_NSLOOKUP) += nslookup.o
35 lib-$(CONFIG_NTPD) += ntpd.o
37 +++ b/networking/netmsg.c
40 + * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
42 + * This is free software, licensed under the GNU General Public License v2.
44 +#include <sys/types.h>
45 +#include <sys/socket.h>
46 +#include <netinet/in.h>
53 +//usage:#define netmsg_trivial_usage NOUSAGE_STR
54 +//usage:#define netmsg_full_usage ""
56 +#ifndef CONFIG_NETMSG
57 +int main(int argc, char **argv)
59 +int netmsg_main(int argc, char **argv)
63 + struct sockaddr_in addr;
65 + unsigned char buf[1001];
68 + fprintf(stderr, "usage: %s <ip> \"<message>\"\n", argv[0]);
72 + if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
73 + perror("Opening socket");
77 + memset(&addr, 0, sizeof(addr));
78 + addr.sin_family = AF_INET;
79 + addr.sin_addr.s_addr = inet_addr(argv[1]);
80 + addr.sin_port = htons(0x1337);
82 + memset(buf, 0, 1001);
86 + strncpy(buf + 2, argv[2], 998);
88 + if (setsockopt (s, SOL_SOCKET, SO_BROADCAST, (caddr_t) &optval, sizeof (optval)) < 0) {
89 + perror("setsockopt()");
93 + if (sendto(s, buf, 1001, 0, (struct sockaddr *) &addr, sizeof(addr)) < 0) {