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