1 --- a/include/applets.h
2 +++ b/include/applets.h
3 @@ -282,6 +282,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))
17 +#define netmsg_trivial_usage NOUSAGE_STR
18 +#define netmsg_full_usage ""
20 #define netstat_trivial_usage \
21 "[-laentuwxr"IF_FEATURE_NETSTAT_WIDE("W")IF_FEATURE_NETSTAT_PRG("p")"]"
22 #define netstat_full_usage "\n\n" \
23 --- a/networking/Config.in
24 +++ b/networking/Config.in
25 @@ -628,6 +628,12 @@ config NC
26 A simple Unix utility which reads and writes data across network
33 + simple program for sending udp broadcast messages
36 bool "Netcat server options (-l)"
38 --- a/networking/Kbuild
39 +++ b/networking/Kbuild
40 @@ -25,6 +25,7 @@ lib-$(CONFIG_IP) += ip.o
41 lib-$(CONFIG_IPCALC) += ipcalc.o
42 lib-$(CONFIG_NAMEIF) += nameif.o
43 lib-$(CONFIG_NC) += nc.o
44 +lib-$(CONFIG_NETMSG) += netmsg.o
45 lib-$(CONFIG_NETSTAT) += netstat.o
46 lib-$(CONFIG_NSLOOKUP) += nslookup.o
47 lib-$(CONFIG_NTPD) += ntpd.o
49 +++ b/networking/netmsg.c
52 + * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
54 + * This is free software, licensed under the GNU General Public License v2.
56 +#include <sys/types.h>
57 +#include <sys/socket.h>
58 +#include <netinet/in.h>
66 +#ifndef CONFIG_NETMSG
67 +int main(int argc, char **argv)
69 +int netmsg_main(int argc, char **argv)
73 + struct sockaddr_in addr;
75 + unsigned char buf[1001];
78 + fprintf(stderr, "usage: %s <ip> \"<message>\"\n", argv[0]);
82 + if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
83 + perror("Opening socket");
87 + memset(&addr, 0, sizeof(addr));
88 + addr.sin_family = AF_INET;
89 + addr.sin_addr.s_addr = inet_addr(argv[1]);
90 + addr.sin_port = htons(0x1337);
92 + memset(buf, 0, 1001);
96 + strncpy(buf + 2, argv[2], 998);
98 + if (setsockopt (s, SOL_SOCKET, SO_BROADCAST, (caddr_t) &optval, sizeof (optval)) < 0) {
99 + perror("setsockopt()");
103 + if (sendto(s, buf, 1001, 0, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
104 + perror("sendto()");