1 --- a/include/applets.src.h
2 +++ b/include/applets.src.h
3 @@ -256,6 +256,7 @@ IF_MT(APPLET(mt, _BB_DIR_BIN, _BB_SUID_D
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_NMETER(APPLET(nmeter, _BB_DIR_USR_BIN, _BB_SUID_DROP))
11 --- a/include/usage.src.h
12 +++ b/include/usage.src.h
15 /* vi: set sw=8 ts=8: */
17 * This file suffers from chronically incorrect tabification
18 @@ -2706,6 +2707,9 @@ INSERT
20 "$ nameif -c /etc/my_mactab_file\n" \
22 +#define netmsg_trivial_usage NOUSAGE_STR
23 +#define netmsg_full_usage ""
25 #define nmeter_trivial_usage \
27 #define nmeter_full_usage "\n\n" \
28 --- a/networking/Config.src
29 +++ b/networking/Config.src
30 @@ -640,6 +640,12 @@ config FEATURE_NAMEIF_EXTENDED
31 new_interface_name mac=00:80:C8:38:91:B5
32 new_interface_name 00:80:C8:38:91:B5
38 + simple program for sending udp broadcast messages
43 --- a/networking/Kbuild.src
44 +++ b/networking/Kbuild.src
45 @@ -27,6 +27,7 @@ lib-$(CONFIG_IP) += ip.o
46 lib-$(CONFIG_IPCALC) += ipcalc.o
47 lib-$(CONFIG_NAMEIF) += nameif.o
48 lib-$(CONFIG_NC) += nc.o
49 +lib-$(CONFIG_NETMSG) += netmsg.o
50 lib-$(CONFIG_NETSTAT) += netstat.o
51 lib-$(CONFIG_NSLOOKUP) += nslookup.o
52 lib-$(CONFIG_NTPD) += ntpd.o
54 +++ b/networking/netmsg.c
57 + * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
59 + * This is free software, licensed under the GNU General Public License v2.
61 +#include <sys/types.h>
62 +#include <sys/socket.h>
63 +#include <netinet/in.h>
71 +#ifndef CONFIG_NETMSG
72 +int main(int argc, char **argv)
74 +int netmsg_main(int argc, char **argv)
78 + struct sockaddr_in addr;
80 + unsigned char buf[1001];
83 + fprintf(stderr, "usage: %s <ip> \"<message>\"\n", argv[0]);
87 + if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
88 + perror("Opening socket");
92 + memset(&addr, 0, sizeof(addr));
93 + addr.sin_family = AF_INET;
94 + addr.sin_addr.s_addr = inet_addr(argv[1]);
95 + addr.sin_port = htons(0x1337);
97 + memset(buf, 0, 1001);
101 + strncpy(buf + 2, argv[2], 998);
103 + if (setsockopt (s, SOL_SOCKET, SO_BROADCAST, (caddr_t) &optval, sizeof (optval)) < 0) {
104 + perror("setsockopt()");
108 + if (sendto(s, buf, 1001, 0, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
109 + perror("sendto()");