mac80211: fill some important capabilities into ht_capab in the hostapd config
[openwrt.git] / package / busybox / patches / 300-netmsg.patch
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))
11 --- a/include/usage.h
12 +++ b/include/usage.h
13 @@ -3010,6 +3010,9 @@
14
15 #endif
16
17 +#define netmsg_trivial_usage NOUSAGE_STR
18 +#define netmsg_full_usage ""
19 +
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
27 connections.
28
29 +config NETMSG
30 + bool "netmsg"
31 + default n
32 + help
33 + simple program for sending udp broadcast messages
34 +
35 config NC_SERVER
36 bool "Netcat server options (-l)"
37 default n
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
48 --- /dev/null
49 +++ b/networking/netmsg.c
50 @@ -0,0 +1,63 @@
51 +/*
52 + * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
53 + *
54 + * This is free software, licensed under the GNU General Public License v2.
55 + */
56 +#include <sys/types.h>
57 +#include <sys/socket.h>
58 +#include <netinet/in.h>
59 +#include <netdb.h>
60 +#include <stdio.h>
61 +#include <stdlib.h>
62 +#include <string.h>
63 +#include "busybox.h"
64 +
65 +
66 +#ifndef CONFIG_NETMSG
67 +int main(int argc, char **argv)
68 +#else
69 +int netmsg_main(int argc, char **argv)
70 +#endif
71 +{
72 + int s;
73 + struct sockaddr_in addr;
74 + int optval = 1;
75 + unsigned char buf[1001];
76 +
77 + if (argc != 3) {
78 + fprintf(stderr, "usage: %s <ip> \"<message>\"\n", argv[0]);
79 + exit(1);
80 + }
81 +
82 + if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
83 + perror("Opening socket");
84 + exit(1);
85 + }
86 +
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);
91 +
92 + memset(buf, 0, 1001);
93 + buf[0] = 0xde;
94 + buf[1] = 0xad;
95 +
96 + strncpy(buf + 2, argv[2], 998);
97 +
98 + if (setsockopt (s, SOL_SOCKET, SO_BROADCAST, (caddr_t) &optval, sizeof (optval)) < 0) {
99 + perror("setsockopt()");
100 + goto fail;
101 + }
102 +
103 + if (sendto(s, buf, 1001, 0, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
104 + perror("sendto()");
105 + goto fail;
106 + }
107 +
108 + return 0;
109 +
110 +fail:
111 + close(s);
112 + exit(1);
113 +}
This page took 0.048699 seconds and 5 git commands to generate.