1 --- a/include/applets.h
2 +++ b/include/applets.h
3 @@ -271,6 +271,7 @@ USE_MT(APPLET(mt, _BB_DIR_BIN, _BB_SUID_
4 USE_MV(APPLET(mv, _BB_DIR_BIN, _BB_SUID_NEVER))
5 USE_NAMEIF(APPLET(nameif, _BB_DIR_SBIN, _BB_SUID_NEVER))
6 USE_NC(APPLET(nc, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
7 +USE_NETMSG(APPLET(netmsg, _BB_DIR_BIN, _BB_SUID_ALWAYS))
8 USE_NETSTAT(APPLET(netstat, _BB_DIR_BIN, _BB_SUID_NEVER))
9 USE_NICE(APPLET(nice, _BB_DIR_BIN, _BB_SUID_NEVER))
10 USE_NMETER(APPLET(nmeter, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
17 +#define netmsg_trivial_usage NOUSAGE_STR
18 +#define netmsg_full_usage ""
20 #define netstat_trivial_usage \
21 "[-laentuwxr"USE_FEATURE_NETSTAT_WIDE("W")USE_FEATURE_NETSTAT_PRG("p")"]"
22 #define netstat_full_usage "\n\n" \
23 --- a/networking/Config.in
24 +++ b/networking/Config.in
25 @@ -600,6 +600,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 @@ -24,6 +24,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_PING) += ping.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()");