use generic inittab for x86
[openwrt.git] / package / busybox / patches / 300-netmsg.patch
1 diff -ruN busybox-1.3.1-old/include/applets.h busybox-1.3.1-new/include/applets.h
2 --- busybox-1.3.1-old/include/applets.h 2006-12-27 05:56:18.000000000 +0100
3 +++ busybox-1.3.1-new/include/applets.h 2006-12-28 07:25:35.000000000 +0100
4 @@ -211,6 +211,7 @@
5 USE_MV(APPLET(mv, _BB_DIR_BIN, _BB_SUID_NEVER))
6 USE_NAMEIF(APPLET(nameif, _BB_DIR_SBIN, _BB_SUID_NEVER))
7 USE_NC(APPLET(nc, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
8 +USE_NETMSG(APPLET_NOUSAGE(netmsg, netmsg, _BB_DIR_BIN, _BB_SUID_ALWAYS))
9 USE_NETSTAT(APPLET(netstat, _BB_DIR_BIN, _BB_SUID_NEVER))
10 USE_NICE(APPLET(nice, _BB_DIR_BIN, _BB_SUID_NEVER))
11 USE_NMETER(APPLET(nmeter, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
12 diff -ruN busybox-1.3.1-old/networking/Config.in busybox-1.3.1-new/networking/Config.in
13 --- busybox-1.3.1-old/networking/Config.in 2006-12-27 05:52:39.000000000 +0100
14 +++ busybox-1.3.1-new/networking/Config.in 2006-12-28 07:25:35.000000000 +0100
15 @@ -452,6 +452,12 @@
16 help
17 A simple Unix utility which reads and writes data across network
18 connections.
19 +
20 +config NETMSG
21 + bool "netmsg"
22 + default n
23 + help
24 + simple program for sending udp broadcast messages
25
26 config NC_SERVER
27 bool "Netcat server options (-lp)"
28 diff -ruN busybox-1.3.1-old/networking/Kbuild busybox-1.3.1-new/networking/Kbuild
29 --- busybox-1.3.1-old/networking/Kbuild 2006-12-27 05:52:39.000000000 +0100
30 +++ busybox-1.3.1-new/networking/Kbuild 2006-12-28 07:28:29.000000000 +0100
31 @@ -25,6 +25,7 @@
32 lib-$(CONFIG_IPTUNNEL) += iptunnel.o
33 lib-$(CONFIG_NAMEIF) += nameif.o
34 lib-$(CONFIG_NC) += nc.o
35 +lib-$(CONFIG_NETMSG) += netmsg.o
36 lib-$(CONFIG_NETSTAT) += netstat.o
37 lib-$(CONFIG_NSLOOKUP) += nslookup.o
38 lib-$(CONFIG_PING) += ping.o
39 diff -ruN busybox-1.3.1-old/networking/netmsg.c busybox-1.3.1-new/networking/netmsg.c
40 --- busybox-1.3.1-old/networking/netmsg.c 1970-01-01 01:00:00.000000000 +0100
41 +++ busybox-1.3.1-new/networking/netmsg.c 2006-12-28 07:25:52.000000000 +0100
42 @@ -0,0 +1,63 @@
43 +/*
44 + * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
45 + *
46 + * This is free software, licensed under the GNU General Public License v2.
47 + */
48 +#include <sys/types.h>
49 +#include <sys/socket.h>
50 +#include <netinet/in.h>
51 +#include <netdb.h>
52 +#include <stdio.h>
53 +#include <stdlib.h>
54 +#include <string.h>
55 +#include "busybox.h"
56 +
57 +
58 +#ifndef CONFIG_NETMSG
59 +int main(int argc, char **argv)
60 +#else
61 +int netmsg_main(int argc, char **argv)
62 +#endif
63 +{
64 + int s;
65 + struct sockaddr_in addr;
66 + int optval = 1;
67 + unsigned char buf[1001];
68 +
69 + if (argc != 3) {
70 + fprintf(stderr, "usage: %s <ip> \"<message>\"\n", argv[0]);
71 + exit(1);
72 + }
73 +
74 + if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
75 + perror("Opening socket");
76 + exit(1);
77 + }
78 +
79 + memset(&addr, 0, sizeof(addr));
80 + addr.sin_family = AF_INET;
81 + addr.sin_addr.s_addr = inet_addr(argv[1]);
82 + addr.sin_port = htons(0x1337);
83 +
84 + memset(buf, 0, 1001);
85 + buf[0] = 0xde;
86 + buf[1] = 0xad;
87 +
88 + strncpy(buf + 2, argv[2], 998);
89 +
90 + if (setsockopt (s, SOL_SOCKET, SO_BROADCAST, (caddr_t) &optval, sizeof (optval)) < 0) {
91 + perror("setsockopt()");
92 + goto fail;
93 + }
94 +
95 + if (sendto(s, buf, 1001, 0, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
96 + perror("sendto()");
97 + goto fail;
98 + }
99 +
100 + return 0;
101 +
102 +fail:
103 + close(s);
104 + exit(1);
105 +}
This page took 0.045886 seconds and 5 git commands to generate.