mac80211: b43: Expose PIO mode fallback
[openwrt.git] / package / busybox / patches / 300-netmsg.patch
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
17 @@ -1,3 +1,4 @@
18 +
19 /* vi: set sw=8 ts=8: */
20 /*
21 * This file suffers from chronically incorrect tabification
22 @@ -2706,6 +2707,9 @@ INSERT
23 " or\n" \
24 "$ nameif -c /etc/my_mactab_file\n" \
25
26 +#define netmsg_trivial_usage NOUSAGE_STR
27 +#define netmsg_full_usage ""
28 +
29 #define nmeter_trivial_usage \
30 "format_string"
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
39
40 +config NETMSG
41 + bool "netmsg"
42 + default n
43 + help
44 + simple program for sending udp broadcast messages
45 +
46 config NETSTAT
47 bool "netstat"
48 default y
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
62 new file mode 100644
63 index 0000000..43aba0d
64 --- /dev/null
65 +++ b/networking/netmsg.c
66 @@ -0,0 +1,63 @@
67 +/*
68 + * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
69 + *
70 + * This is free software, licensed under the GNU General Public License v2.
71 + */
72 +#include <sys/types.h>
73 +#include <sys/socket.h>
74 +#include <netinet/in.h>
75 +#include <netdb.h>
76 +#include <stdio.h>
77 +#include <stdlib.h>
78 +#include <string.h>
79 +#include "busybox.h"
80 +
81 +
82 +#ifndef CONFIG_NETMSG
83 +int main(int argc, char **argv)
84 +#else
85 +int netmsg_main(int argc, char **argv)
86 +#endif
87 +{
88 + int s;
89 + struct sockaddr_in addr;
90 + int optval = 1;
91 + unsigned char buf[1001];
92 +
93 + if (argc != 3) {
94 + fprintf(stderr, "usage: %s <ip> \"<message>\"\n", argv[0]);
95 + exit(1);
96 + }
97 +
98 + if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
99 + perror("Opening socket");
100 + exit(1);
101 + }
102 +
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);
107 +
108 + memset(buf, 0, 1001);
109 + buf[0] = 0xde;
110 + buf[1] = 0xad;
111 +
112 + strncpy(buf + 2, argv[2], 998);
113 +
114 + if (setsockopt (s, SOL_SOCKET, SO_BROADCAST, (caddr_t) &optval, sizeof (optval)) < 0) {
115 + perror("setsockopt()");
116 + goto fail;
117 + }
118 +
119 + if (sendto(s, buf, 1001, 0, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
120 + perror("sendto()");
121 + goto fail;
122 + }
123 +
124 + return 0;
125 +
126 +fail:
127 + close(s);
128 + exit(1);
129 +}
This page took 0.046921 seconds and 5 git commands to generate.