1 diff --git a/include/applets.src.h b/include/applets.src.h
2 index f4fab53..f97f2d8 100644
3 --- a/include/applets.src.h
4 +++ b/include/applets.src.h
5 @@ -256,6 +256,7 @@ IF_MT(APPLET(mt, _BB_DIR_BIN, _BB_SUID_DROP))
6 IF_MV(APPLET(mv, _BB_DIR_BIN, _BB_SUID_DROP))
7 IF_NAMEIF(APPLET(nameif, _BB_DIR_SBIN, _BB_SUID_DROP))
8 IF_NC(APPLET(nc, _BB_DIR_USR_BIN, _BB_SUID_DROP))
9 +IF_NETMSG(APPLET(netmsg, _BB_DIR_BIN, _BB_SUID_REQUIRE))
10 IF_NETSTAT(APPLET(netstat, _BB_DIR_BIN, _BB_SUID_DROP))
11 IF_NICE(APPLET(nice, _BB_DIR_BIN, _BB_SUID_DROP))
12 IF_NMETER(APPLET(nmeter, _BB_DIR_USR_BIN, _BB_SUID_DROP))
13 diff --git a/include/usage.src.h b/include/usage.src.h
14 index 30fef24..ac78992 100644
15 --- a/include/usage.src.h
16 +++ b/include/usage.src.h
19 /* vi: set sw=8 ts=8: */
21 * This file suffers from chronically incorrect tabification
22 @@ -2706,6 +2707,9 @@ INSERT
24 "$ nameif -c /etc/my_mactab_file\n" \
26 +#define netmsg_trivial_usage NOUSAGE_STR
27 +#define netmsg_full_usage ""
29 #define nmeter_trivial_usage \
31 #define nmeter_full_usage "\n\n" \
32 diff --git a/networking/Config.src b/networking/Config.src
33 index 6dd7df7..4682dd3 100644
34 --- a/networking/Config.src
35 +++ b/networking/Config.src
36 @@ -640,6 +640,12 @@ config FEATURE_NAMEIF_EXTENDED
37 new_interface_name mac=00:80:C8:38:91:B5
38 new_interface_name 00:80:C8:38:91:B5
44 + simple program for sending udp broadcast messages
49 diff --git a/networking/Kbuild.src b/networking/Kbuild.src
50 index f41a2df..6070a40 100644
51 --- a/networking/Kbuild.src
52 +++ b/networking/Kbuild.src
53 @@ -27,6 +27,7 @@ lib-$(CONFIG_IP) += ip.o
54 lib-$(CONFIG_IPCALC) += ipcalc.o
55 lib-$(CONFIG_NAMEIF) += nameif.o
56 lib-$(CONFIG_NC) += nc.o
57 +lib-$(CONFIG_NETMSG) += netmsg.o
58 lib-$(CONFIG_NETSTAT) += netstat.o
59 lib-$(CONFIG_NSLOOKUP) += nslookup.o
60 lib-$(CONFIG_NTPD) += ntpd.o
61 diff --git a/networking/netmsg.c b/networking/netmsg.c
63 index 0000000..43aba0d
65 +++ b/networking/netmsg.c
68 + * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
70 + * This is free software, licensed under the GNU General Public License v2.
72 +#include <sys/types.h>
73 +#include <sys/socket.h>
74 +#include <netinet/in.h>
82 +#ifndef CONFIG_NETMSG
83 +int main(int argc, char **argv)
85 +int netmsg_main(int argc, char **argv)
89 + struct sockaddr_in addr;
91 + unsigned char buf[1001];
94 + fprintf(stderr, "usage: %s <ip> \"<message>\"\n", argv[0]);
98 + if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
99 + perror("Opening socket");
103 + memset(&addr, 0, sizeof(addr));
104 + addr.sin_family = AF_INET;
105 + addr.sin_addr.s_addr = inet_addr(argv[1]);
106 + addr.sin_port = htons(0x1337);
108 + memset(buf, 0, 1001);
112 + strncpy(buf + 2, argv[2], 998);
114 + if (setsockopt (s, SOL_SOCKET, SO_BROADCAST, (caddr_t) &optval, sizeof (optval)) < 0) {
115 + perror("setsockopt()");
119 + if (sendto(s, buf, 1001, 0, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
120 + perror("sendto()");