summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-oe/recipes-extended/rarpd/rarpd/0001-rarpd.8-add-man-file.patch89
-rw-r--r--meta-oe/recipes-extended/rarpd/rarpd/0002-Makefile-modify-compile-parameters.patch26
-rw-r--r--meta-oe/recipes-extended/rarpd/rarpd/0003-rarpd.c-bug-fix.patch263
-rw-r--r--meta-oe/recipes-extended/rarpd/rarpd/0004-rarpd.init-add-new-init-file.patch116
-rw-r--r--meta-oe/recipes-extended/rarpd/rarpd/0005-ethernet.c-remove-it.patch244
-rw-r--r--meta-oe/recipes-extended/rarpd/rarpd/ethers.sample1
-rw-r--r--meta-oe/recipes-extended/rarpd/rarpd/rarpd.service14
-rw-r--r--meta-oe/recipes-extended/rarpd/rarpd_ss981107.bb49
8 files changed, 802 insertions, 0 deletions
diff --git a/meta-oe/recipes-extended/rarpd/rarpd/0001-rarpd.8-add-man-file.patch b/meta-oe/recipes-extended/rarpd/rarpd/0001-rarpd.8-add-man-file.patch
new file mode 100644
index 0000000000..77c75b4a27
--- /dev/null
+++ b/meta-oe/recipes-extended/rarpd/rarpd/0001-rarpd.8-add-man-file.patch
@@ -0,0 +1,89 @@
1From d91161eb163c16408202a91b4325a3381ab33752 Mon Sep 17 00:00:00 2001
2From: Li xin <lixin.fnst@cn.fujitsu.com>
3Date: Tue, 18 Nov 2014 17:55:31 +0900
4Subject: [PATCH 1/5] rarpd.8 : add man file
5
6Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
7---
8 rarpd.8 | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
9 1 file changed, 69 insertions(+)
10 create mode 100644 rarpd.8
11
12diff --git a/rarpd.8 b/rarpd.8
13new file mode 100644
14index 0000000..ce7bd70
15--- /dev/null
16+++ b/rarpd.8
17@@ -0,0 +1,69 @@
18+.TH RARP 8 "7 April 2000" "rarpd" "Linux Programmer's Manual"
19+.SH NAME
20+rarpd \- Reverse Address Resolution Protocol (RARP) daemon
21+.SH SYNOPSIS
22+.B "rarpd [-aAvde] [-b bootdir ] [ interface ]"
23+.SH DESCRIPTION
24+.B Rarpd
25+is a daemon which responds to RARP requests.
26+RARP is used by some machines at boot time to discover their IP address.
27+They provide their Ethernet address and
28+.B rarpd
29+responds with their IP address if it finds it in the ethers database
30+(either
31+.I /etc/ethers
32+file or NIS+ lookup) and using DNS lookup if ethers database
33+contains a hostname and not an IP address.
34+By default
35+.B rarpd
36+also checks if a bootable image with a name starting with the IP address
37+in hexadecimal uppercase letters is present in the TFTP boot directory
38+(usually
39+.I /tftpboot
40+) before it decides to respond to the RARP request.
41+.SH OPTIONS
42+.TP
43+.B \-a
44+Do not bind to the interface.
45+.TP
46+.B \-A
47+Respond to ARP as well as RARP requests.
48+.TP
49+.B \-v
50+Tell the user what is going on by being verbose.
51+.TP
52+.B \-d
53+Debugging mode. Do not detach from the tty.
54+.TP
55+.B \-e
56+Skip the check for bootable image in the TFTP boot directory. If not
57+present, then even if the Ethernet address is present in
58+the ethers database but the bootable image for the resolved IP does not exist,
59+.B rarpd
60+will not respond to the request.
61+.TP
62+.B "\-b bootdir"
63+Use
64+.I bootdir
65+instead of the default
66+.I /tftpboot
67+as the TFTP boot directory for bootable image checks.
68+.SH OBSOLETES
69+This
70+.B rarpd
71+obsoletes kernel
72+.B rarp
73+daemon present in Linux kernels up to 2.2 which was controlled by the
74+rarp(8) command.
75+.SH FILES
76+.I /etc/ethers,
77+.br
78+.I /etc/nsswitch.conf,
79+.br
80+.I /tftpboot
81+.SH SEE ALSO
82+ethers(5)
83+.SH AUTHORS
84+Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
85+.br
86+Jakub Jelinek, <jakub@redhat.com>
87--
881.8.4.2
89
diff --git a/meta-oe/recipes-extended/rarpd/rarpd/0002-Makefile-modify-compile-parameters.patch b/meta-oe/recipes-extended/rarpd/rarpd/0002-Makefile-modify-compile-parameters.patch
new file mode 100644
index 0000000000..0b3ebc468f
--- /dev/null
+++ b/meta-oe/recipes-extended/rarpd/rarpd/0002-Makefile-modify-compile-parameters.patch
@@ -0,0 +1,26 @@
1From d23b13bd959204824070433d954c5dfbfc421bb7 Mon Sep 17 00:00:00 2001
2From: Li xin <lixin.fnst@cn.fujitsu.com>
3Date: Tue, 18 Nov 2014 18:05:27 +0900
4Subject: [PATCH 2/5] Makefile : modify compile parameters
5
6Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
7---
8 Makefile | 2 +-
9 1 file changed, 1 insertion(+), 1 deletion(-)
10
11diff --git a/Makefile b/Makefile
12index 19966b4..86a8169 100644
13--- a/Makefile
14+++ b/Makefile
15@@ -1,7 +1,7 @@
16 CC=gcc
17 CFLAGS=-O2 -Wall -g $(DEFINES)
18
19-OBJ=rarpd.o ethernet.o
20+OBJ=rarpd.o
21
22 all: rarpd
23
24--
251.8.4.2
26
diff --git a/meta-oe/recipes-extended/rarpd/rarpd/0003-rarpd.c-bug-fix.patch b/meta-oe/recipes-extended/rarpd/rarpd/0003-rarpd.c-bug-fix.patch
new file mode 100644
index 0000000000..7ce1279090
--- /dev/null
+++ b/meta-oe/recipes-extended/rarpd/rarpd/0003-rarpd.c-bug-fix.patch
@@ -0,0 +1,263 @@
1From b49c8e6e66801406520d1bff791c66dff7b1cddb Mon Sep 17 00:00:00 2001
2From: Li xin <lixin.fnst@cn.fujitsu.com>
3Date: Tue, 18 Nov 2014 18:10:20 +0900
4Subject: [PATCH 3/5] rarpd.c : bug fix
5
6Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
7---
8 rarpd.c | 98 +++++++++++++++++++++++++++++++++++++----------------------------
9 1 file changed, 56 insertions(+), 42 deletions(-)
10
11diff --git a/rarpd.c b/rarpd.c
12index 335d2d2..d45300e 100644
13--- a/rarpd.c
14+++ b/rarpd.c
15@@ -7,9 +7,11 @@
16 * 2 of the License, or (at your option) any later version.
17 *
18 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
19+ * Jakub Jelinek, <jakub@redhat.com>
20 */
21
22 #include <stdio.h>
23+#include <stdlib.h>
24 #include <syslog.h>
25 #include <dirent.h>
26 #include <malloc.h>
27@@ -26,6 +28,8 @@
28 #include <net/if.h>
29 #include <net/if_arp.h>
30 #include <netinet/in.h>
31+#include <netinet/ether.h>
32+#include <asm/types.h>
33 #include <linux/if_packet.h>
34 #include <linux/filter.h>
35
36@@ -39,27 +43,26 @@ int only_ethers;
37 int all_ifaces;
38 int listen_arp;
39 char *ifname;
40-char *tftp_dir = "/etc/tftpboot";
41+char *tftp_dir = "/tftpboot";
42
43-extern int ether_ntohost(char *name, unsigned char *ea);
44 void usage(void) __attribute__((noreturn));
45
46-struct iflink
47+struct rarpiflink
48 {
49- struct iflink *next;
50- int index;
51- int hatype;
52- unsigned char lladdr[16];
53- unsigned char name[IFNAMSIZ];
54- struct ifaddr *ifa_list;
55+ struct rarpiflink *next;
56+ int index;
57+ int hatype;
58+ unsigned char lladdr[16];
59+ unsigned char name[IFNAMSIZ];
60+ struct rarpifaddr *ifa_list;
61 } *ifl_list;
62
63-struct ifaddr
64+struct rarpifaddr
65 {
66- struct ifaddr *next;
67- __u32 prefix;
68- __u32 mask;
69- __u32 local;
70+ struct rarpifaddr *next;
71+ __u32 prefix;
72+ __u32 mask;
73+ __u32 local;
74 };
75
76 struct rarp_map
77@@ -87,8 +90,8 @@ void load_if()
78 {
79 int fd;
80 struct ifreq *ifrp, *ifend;
81- struct iflink *ifl;
82- struct ifaddr *ifa;
83+ struct rarpiflink *ifl;
84+ struct rarpifaddr *ifa;
85 struct ifconf ifc;
86 struct ifreq ibuf[256];
87
88@@ -144,7 +147,7 @@ void load_if()
89 continue;
90 }
91
92- ifl = (struct iflink*)malloc(sizeof(*ifl));
93+ ifl = (struct rarpiflink*)malloc(sizeof(*ifl));
94 if (ifl == NULL)
95 continue;
96 memset(ifl, 0, sizeof(*ifl));
97@@ -154,6 +157,7 @@ void load_if()
98 ifl->hatype = ifrp->ifr_hwaddr.sa_family;
99 memcpy(ifl->lladdr, ifrp->ifr_hwaddr.sa_data, 14);
100 strncpy(ifl->name, ifrp->ifr_name, IFNAMSIZ);
101+ ifl->name[IFNAMSIZ-1] = 0;
102 p = strchr(ifl->name, ':');
103 if (p)
104 *p = 0;
105@@ -179,7 +183,7 @@ void load_if()
106 if (ifa == NULL) {
107 if (mask == 0 || prefix == 0)
108 continue;
109- ifa = (struct ifaddr*)malloc(sizeof(*ifa));
110+ ifa = (struct rarpifaddr*)malloc(sizeof(*ifa));
111 memset(ifa, 0, sizeof(*ifa));
112 ifa->local = addr;
113 ifa->prefix = prefix;
114@@ -207,6 +211,7 @@ void load_if()
115 }
116 }
117 }
118+ close(fd);
119 }
120
121 void configure()
122@@ -225,20 +230,21 @@ int bootable(__u32 addr)
123 d = opendir(tftp_dir);
124 if (d == NULL) {
125 syslog(LOG_ERR, "opendir: %m");
126- return 0;
127+ goto done_bootable;
128 }
129 while ((dent = readdir(d)) != NULL) {
130 if (strncmp(dent->d_name, name, 8) == 0)
131 break;
132 }
133+done_bootable:
134 closedir(d);
135 return dent != NULL;
136 }
137
138-struct ifaddr *select_ipaddr(int ifindex, __u32 *sel_addr, __u32 **alist)
139+struct rarpifaddr *select_ipaddr(int ifindex, __u32 *sel_addr, __u32 **alist)
140 {
141- struct iflink *ifl;
142- struct ifaddr *ifa;
143+ struct rarpiflink *ifl;
144+ struct rarpifaddr *ifa;
145 int retry = 0;
146 int i;
147
148@@ -294,7 +300,7 @@ struct rarp_map *rarp_lookup(int ifindex, int hatype,
149
150 if (r == NULL) {
151 if (hatype == ARPHRD_ETHER && halen == 6) {
152- struct ifaddr *ifa;
153+ struct rarpifaddr *ifa;
154 struct hostent *hp;
155 char ename[256];
156 static struct rarp_map emap = {
157@@ -304,7 +310,7 @@ struct rarp_map *rarp_lookup(int ifindex, int hatype,
158 6,
159 };
160
161- if (ether_ntohost(ename, lladdr) != 0 ||
162+ if (ether_ntohost(ename, (struct ether_addr *)lladdr) != 0 ||
163 (hp = gethostbyname(ename)) == NULL) {
164 if (verbose)
165 syslog(LOG_INFO, "not found in /etc/ethers");
166@@ -345,7 +351,7 @@ static int load_arp_bpflet(int fd)
167
168 int put_mylladdr(unsigned char **ptr_p, int ifindex, int alen)
169 {
170- struct iflink *ifl;
171+ struct rarpiflink *ifl;
172
173 for (ifl=ifl_list; ifl; ifl = ifl->next)
174 if (ifl->index == ifindex)
175@@ -362,8 +368,8 @@ int put_mylladdr(unsigned char **ptr_p, int ifindex, int alen)
176 int put_myipaddr(unsigned char **ptr_p, int ifindex, __u32 hisipaddr)
177 {
178 __u32 laddr = 0;
179- struct iflink *ifl;
180- struct ifaddr *ifa;
181+ struct rarpiflink *ifl;
182+ struct rarpifaddr *ifa;
183
184 for (ifl=ifl_list; ifl; ifl = ifl->next)
185 if (ifl->index == ifindex)
186@@ -388,7 +394,7 @@ void arp_advise(int ifindex, unsigned char *lladdr, int lllen, __u32 ipaddr)
187 int fd;
188 struct arpreq req;
189 struct sockaddr_in *sin;
190- struct iflink *ifl;
191+ struct rarpiflink *ifl;
192
193 for (ifl=ifl_list; ifl; ifl = ifl->next)
194 if (ifl->index == ifindex)
195@@ -421,6 +427,10 @@ void serve_it(int fd)
196 struct rarp_map *rmap;
197 unsigned char *ptr;
198 int n;
199+ int i;
200+ char tmpbuf[16*3];
201+ char tmpname[IFNAMSIZ];
202+ struct rarpiflink *ifl;
203
204 n = recvfrom(fd, buf, sizeof(buf), MSG_DONTWAIT, (struct sockaddr*)&sll, &sll_len);
205 if (n<0) {
206@@ -447,21 +457,23 @@ void serve_it(int fd)
207 if (a->ar_op != htons(ARPOP_RREQUEST))
208 return;
209
210- if (verbose) {
211- int i;
212- char tmpbuf[16*3];
213- char *ptr = tmpbuf;
214- for (i=0; i<sll.sll_halen; i++) {
215- if (i) {
216- sprintf(ptr, ":%02x", sll.sll_addr[i]);
217- ptr++;
218- } else
219- sprintf(ptr, "%02x", sll.sll_addr[i]);
220- ptr += 2;
221- }
222- syslog(LOG_INFO, "RARP request from %s on if%d", tmpbuf, sll.sll_ifindex);
223+ ptr = tmpbuf;
224+ snprintf(tmpbuf, 2, "%02x", sll.sll_addr[0]);
225+ for (ptr=tmpbuf+2, i=1; i<sll.sll_halen; i++) {
226+ snprintf(ptr, 3, ":%02x", sll.sll_addr[i]);
227+ ptr += 3;
228 }
229
230+ for (ifl=ifl_list; ifl; ifl = ifl->next)
231+ if (ifl->index == sll.sll_ifindex)
232+ break;
233+ if (ifl) {
234+ strncpy(tmpname, ifl->name, IFNAMSIZ);
235+ tmpname[IFNAMSIZ-1] = 0;
236+ } else
237+ sprintf(tmpname, "if%d", sll.sll_ifindex);
238+ syslog(LOG_INFO, "RARP request from %s on %s", tmpbuf, tmpname);
239+
240 /* Sanity checks */
241
242 /* 1. IP only -> pln==4 */
243@@ -526,6 +538,8 @@ void serve_it(int fd)
244 ptr += rmap->lladdr_len;
245 memcpy(ptr, &rmap->ipaddr, 4);
246 ptr += 4;
247+ syslog(LOG_INFO, "RARP response to %s %s on %s", tmpbuf,
248+ inet_ntoa(*(struct in_addr *)&rmap->ipaddr), tmpname);
249
250 /* Update our ARP cache. Probably, this guy
251 will not able to make ARP (if it is broken)
252@@ -613,7 +627,7 @@ int main(int argc, char **argv)
253 if (ifname) {
254 struct ifreq ifr;
255 memset(&ifr, 0, sizeof(ifr));
256- strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
257+ strncpy(ifr.ifr_name, ifname, IFNAMSIZ-1);
258 if (ioctl(pset[0].fd, SIOCGIFINDEX, &ifr)) {
259 perror("ioctl(SIOCGIFINDEX)");
260 usage();
261--
2621.8.4.2
263
diff --git a/meta-oe/recipes-extended/rarpd/rarpd/0004-rarpd.init-add-new-init-file.patch b/meta-oe/recipes-extended/rarpd/rarpd/0004-rarpd.init-add-new-init-file.patch
new file mode 100644
index 0000000000..3ba11ffe55
--- /dev/null
+++ b/meta-oe/recipes-extended/rarpd/rarpd/0004-rarpd.init-add-new-init-file.patch
@@ -0,0 +1,116 @@
1From 0ef1a95b220c7e110da950e5cc544c50c25b1bc6 Mon Sep 17 00:00:00 2001
2From: Li xin <lixin.fnst@cn.fujitsu.com>
3Date: Tue, 18 Nov 2014 18:11:56 +0900
4Subject: [PATCH 4/5] rarpd.init : add new init file
5
6Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
7---
8 rarpd.init | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
9 1 file changed, 96 insertions(+)
10 create mode 100644 rarpd.init
11
12diff --git a/rarpd.init b/rarpd.init
13new file mode 100644
14index 0000000..efcf825
15--- /dev/null
16+++ b/rarpd.init
17@@ -0,0 +1,96 @@
18+#!/bin/bash
19+#
20+# /etc/init.d/rarpd
21+#
22+# Starts the rarpd daemon
23+#
24+# chkconfig: - 82 16
25+# description: Server Reverse Address Resolution Protocol requests.
26+# processname: rarpd
27+
28+### BEGIN INIT INFO
29+# Provides: rarpd
30+# Required-Start: $syslog $network
31+# Required-Stop: $syslog $network
32+# Default-Start:
33+# Default-Stop: 0 1 2 3 4 5 6
34+# Short-Description: start and stop rarpd
35+# Description: RARP (Reverse Address Resolution Protocol) is a protocol \
36+# which allows individual devices on an IP network to get \
37+# their own IP addresses from the RARP server. \
38+### END INIT INFO
39+
40+# Source function library.
41+. /etc/init.d/functions
42+
43+# Read the config file if exists
44+if [ -f /etc/sysconfig/rarpd ]; then
45+ . /etc/sysconfig/rarpd
46+fi
47+
48+RETVAL=0
49+prog="rarpd"
50+
51+
52+start() {
53+ #if these files don't exist rarpd can't work
54+ test -x /usr/sbin/rarpd -a -f /etc/ethers || exit 6
55+ # Check if rarpd is already running
56+ #if [ ! -f /var/lock/subsys/rarpd ]; then
57+ status rarpd;
58+ if [ $? -ne 0 ]; then
59+ echo -n $"Starting $prog: "
60+ daemon /usr/sbin/rarpd $OPTIONS $INTERFACE
61+ RETVAL=$?
62+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/rarpd
63+ echo
64+ fi
65+ return $RETVAL
66+}
67+
68+stop() {
69+ echo -n $"Stopping $prog: "
70+ killproc /usr/sbin/rarpd
71+ RETVAL=$?
72+ [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/rarpd
73+ echo
74+ return $RETVAL
75+}
76+reload() {
77+ RETVAL=3
78+}
79+
80+#
81+# See how we were called.
82+#
83+case "$1" in
84+ start)
85+ start
86+ ;;
87+ stop)
88+ stop
89+ ;;
90+ reload)
91+ reload
92+ ;;
93+ force-reload|restart)
94+ stop
95+ start
96+ ;;
97+ condrestart)
98+ if [ -f /var/lock/subsys/rarpd ]; then
99+ stop
100+ start
101+ fi
102+ ;;
103+ status)
104+ status rarpd
105+ RETVAL=$?
106+ ;;
107+ *)
108+ echo $"Usage: $0 {start|stop|restart|condrestart|reload|status|force-reload}"
109+ RETVAL=2
110+
111+esac
112+
113+exit $RETVAL
114--
1151.8.4.2
116
diff --git a/meta-oe/recipes-extended/rarpd/rarpd/0005-ethernet.c-remove-it.patch b/meta-oe/recipes-extended/rarpd/rarpd/0005-ethernet.c-remove-it.patch
new file mode 100644
index 0000000000..c77c806127
--- /dev/null
+++ b/meta-oe/recipes-extended/rarpd/rarpd/0005-ethernet.c-remove-it.patch
@@ -0,0 +1,244 @@
1From abe15ba10ddc3548c528ccb088097d7abf5be48b Mon Sep 17 00:00:00 2001
2From: Li xin <lixin.fnst@cn.fujitsu.com>
3Date: Tue, 18 Nov 2014 18:14:07 +0900
4Subject: [PATCH 5/5] ethernet.c : remove it
5
6Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
7---
8 ethernet.c | 224 -------------------------------------------------------------
9 1 file changed, 224 deletions(-)
10 delete mode 100644 ethernet.c
11
12diff --git a/ethernet.c b/ethernet.c
13deleted file mode 100644
14index d682b63..0000000
15--- a/ethernet.c
16+++ /dev/null
17@@ -1,224 +0,0 @@
18-/*
19- * Copyright (c) 1990, 1993 The Regents of the University of California.
20- * All rights reserved.
21- *
22- * Redistribution and use in source and binary forms, with or without
23- * modification, are permitted provided that: (1) source code distributions
24- * retain the above copyright notice and this paragraph in its entirety, (2)
25- * distributions including binary code include the above copyright notice and
26- * this paragraph in its entirety in the documentation or other materials
27- * provided with the distribution, and (3) all advertising materials mentioning
28- * features or use of this software display the following acknowledgement:
29- * ``This product includes software developed by the University of California,
30- * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
31- * the University nor the names of its contributors may be used to endorse
32- * or promote products derived from this software without specific prior
33- * written permission.
34- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
35- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
36- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
37- */
38-#ifndef lint
39-static char rcsid[] =
40- "@(#) $Header: etherent.c,v 1.4 96/06/14 20:34:25 leres Exp $ (LBL)";
41-#endif
42-
43-#include <sys/types.h>
44-#include <sys/stat.h>
45-#include <sys/time.h>
46-
47-#include <ctype.h>
48-#include <stdio.h>
49-#include <string.h>
50-
51-#ifndef ETHERS_FILE
52-#define ETHERS_FILE "/etc/ethers"
53-#endif
54-
55-struct etherent {
56- u_char addr[6];
57- char name[122];
58-};
59-
60-static FILE *ether_fp = NULL;
61-
62-
63-/* Hex digit to integer. */
64-static inline int
65-xdtoi(c)
66- int c;
67-{
68-
69- if (isdigit(c))
70- return c - '0';
71- else if (islower(c))
72- return c - 'a' + 10;
73- else
74- return c - 'A' + 10;
75-}
76-
77-static inline int
78-skip_space(f)
79- FILE *f;
80-{
81- int c;
82-
83- do {
84- c = getc(f);
85- } while (isspace(c) && c != '\n');
86-
87- return c;
88-}
89-
90-static inline int
91-skip_line(f)
92- FILE *f;
93-{
94- int c;
95-
96- do
97- c = getc(f);
98- while (c != '\n' && c != EOF);
99-
100- return c;
101-}
102-
103-static struct etherent *
104-next_etherent(fp)
105- FILE *fp;
106-{
107- register int c, d, i;
108- char *bp;
109- static struct etherent e;
110- static int nline = 1;
111- top:
112- while (nline) {
113- /* Find addr */
114- c = skip_space(fp);
115- if (c == '\n')
116- continue;
117- /* If this is a comment, or first thing on line
118- cannot be etehrnet address, skip the line. */
119- else if (!isxdigit(c))
120- c = skip_line(fp);
121- else {
122- /* must be the start of an address */
123- for (i = 0; i < 6; i += 1) {
124- d = xdtoi(c);
125- c = getc(fp);
126- if (c != ':') {
127- d <<= 4;
128- d |= xdtoi(c);
129- c = getc(fp);
130- }
131- e.addr[i] = d;
132- if (c != ':')
133- break;
134- c = getc(fp);
135- }
136- nline = 0;
137- }
138- if (c == EOF)
139- return NULL;
140- }
141-
142- /* If we started a new line, 'c' holds the char past the ether addr,
143- which we assume is white space. If we are continuing a line,
144- 'c' is garbage. In either case, we can throw it away. */
145-
146- c = skip_space(fp);
147- if (c == '\n') {
148- nline = 1;
149- goto top;
150- }
151- else if (c == '#') {
152- (void)skip_line(fp);
153- nline = 1;
154- goto top;
155- }
156- else if (c == EOF)
157- return NULL;
158-
159- /* Must be a name. */
160- bp = e.name;
161- /* Use 'd' to prevent buffer overflow. */
162- d = sizeof(e.name) - 1;
163- do {
164- *bp++ = c;
165- c = getc(fp);
166- } while (!isspace(c) && c != EOF && --d > 0);
167- *bp = '\0';
168- if (c == '\n')
169- nline = 1;
170-
171- return &e;
172-}
173-
174-/* Open/rewind the ethers files; returns 1 if file was reopened */
175-int
176-ether_rewind()
177-{
178- struct stat st;
179- static long mtime = 0, ctime = 0;
180-
181- if (ether_fp != NULL) {
182- if (fstat(fileno(ether_fp), &st) < 0 ||
183- mtime != st.st_mtime || ctime != st.st_ctime ||
184- fseek(ether_fp, 0L, SEEK_SET) < 0) {
185- fclose(ether_fp);
186- ether_fp = NULL;
187- }
188- }
189- if (ether_fp == NULL) {
190- ether_fp = fopen(ETHERS_FILE, "r");
191- if (ether_fp == NULL)
192- return (-1);
193- if (fstat(fileno(ether_fp), &st) < 0) {
194- fclose(ether_fp);
195- ether_fp = NULL;
196- return (-1);
197- }
198- mtime = st.st_mtime;
199- ctime = st.st_ctime;
200- return (1);
201- }
202- return (0);
203-}
204-
205-/* Map an ethernet address to a name; returns 0 on success, else 1. */
206-int
207-ether_ntohost(name, ea)
208- register char *name;
209- register u_char *ea;
210-{
211- register struct etherent *ep;
212-
213- if (ether_rewind() < 0)
214- return (1);
215-
216- while ((ep = next_etherent(ether_fp)) != NULL)
217- if (bcmp(ep->addr, ea, 6) == 0) {
218- strcpy(name, ep->name);
219- return (0);
220- }
221- return (1);
222-}
223-
224-/* Map an ethernet name to an address; returns 0 on success, else 1. */
225-int
226-ether_hostton(name, ea)
227- register char *name;
228- register u_char *ea;
229-{
230- register struct etherent *ep;
231-
232- if (ether_rewind() < 0)
233- return (1);
234-
235- while ((ep = next_etherent(ether_fp)) != NULL)
236- if (strcmp(ep->name, name) == 0) {
237- bcopy(ep->addr, ea, 6);
238- return (0);
239- }
240- return (1);
241-}
242--
2431.8.4.2
244
diff --git a/meta-oe/recipes-extended/rarpd/rarpd/ethers.sample b/meta-oe/recipes-extended/rarpd/rarpd/ethers.sample
new file mode 100644
index 0000000000..249ca6b3c3
--- /dev/null
+++ b/meta-oe/recipes-extended/rarpd/rarpd/ethers.sample
@@ -0,0 +1 @@
# see man ethers for syntax
diff --git a/meta-oe/recipes-extended/rarpd/rarpd/rarpd.service b/meta-oe/recipes-extended/rarpd/rarpd/rarpd.service
new file mode 100644
index 0000000000..137710eb15
--- /dev/null
+++ b/meta-oe/recipes-extended/rarpd/rarpd/rarpd.service
@@ -0,0 +1,14 @@
1[Unit]
2Description=Reverse Address Resolution Protocol Requests Server
3Requires=network.target
4After=syslog.target network.target
5
6[Service]
7Type=forking
8EnvironmentFile=-/etc/sysconfig/rarpd
9ExecStart=/usr/sbin/rarpd $OPTIONS $INTERFACE
10StandardError=syslog
11
12[Install]
13WantedBy=multi-user.target
14
diff --git a/meta-oe/recipes-extended/rarpd/rarpd_ss981107.bb b/meta-oe/recipes-extended/rarpd/rarpd_ss981107.bb
new file mode 100644
index 0000000000..d69499db7e
--- /dev/null
+++ b/meta-oe/recipes-extended/rarpd/rarpd_ss981107.bb
@@ -0,0 +1,49 @@
1SUMMARY = "The RARP daemon."
2DESCRIPTION = "RARP (Reverse Address Resolution Protocol) is a protocol which \
3allows individual devices on an IP network to get their own IP addresses from \
4the RARP server. Some machines (e.g. SPARC boxes) use this protocol instead \
5of e.g. DHCP to query their IP addresses during network bootup. \
6Linux kernels up to 2.2 used to provide a kernel daemon for this service, \
7but since 2.3 kernels it is served by this userland daemon. \
8You should install rarpd if you want to set up a RARP server on your \
9network."
10SECTION = "System Environment/Daemons"
11
12SRC_URI = "http://pkgs.fedoraproject.org/repo/pkgs/${PN}/${PN}-${PV}.tar.gz/be2a88f8ccddf2a40ac484cb3294fedc/${PN}-${PV}.tar.gz"
13SRC_URI[md5sum] = "be2a88f8ccddf2a40ac484cb3294fedc"
14SRC_URI[sha256sum] = "4d6145d435a5d8b567b9798620f57f9b0a464078a1deba267958f168fbe776e6"
15
16SRC_URI += "file://0001-rarpd.8-add-man-file.patch \
17 file://0002-Makefile-modify-compile-parameters.patch \
18 file://0003-rarpd.c-bug-fix.patch \
19 file://0004-rarpd.init-add-new-init-file.patch \
20 file://0005-ethernet.c-remove-it.patch \
21 file://ethers.sample \
22 file://rarpd.service \
23"
24
25LICENSE = "GPLv2+"
26LIC_FILES_CHKSUM = "file://rarpd.c;md5=199b20b172ea93121bc613a9c77b6931"
27
28S = "${WORKDIR}/${PN}"
29
30do_install() {
31 install -d ${D}${sysconfdir}/init.d
32 install -d ${D}${sbindir}
33 install -d ${D}${mandir}/man8
34 install -m 755 rarpd.init ${D}${sysconfdir}/init.d/rarpd
35 install -m 755 rarpd ${D}${sbindir}/rarpd
36 install -m 644 rarpd.8 ${D}${mandir}/man8/rarpd.8
37 install -m 644 ${WORKDIR}/ethers.sample ${D}${sysconfdir}/ethers
38
39 if ${@base_contains('DISTRO_FEATURES','systemd','true','false',d)}; then
40 install -d ${D}${systemd_unitdir}/system
41 install -m 0644 ${WORKDIR}/rarpd.service ${D}${systemd_unitdir}/system/
42 fi
43}
44
45inherit ${@base_contains('VIRTUAL-RUNTIME_init_manager','systemd','systemd','',d)}
46
47SYSTEMD_PACKAGES = "${PN}"
48SYSTEMD_SERVICE_${PN} = "rarpd.service"
49SYSTEMD_AUTO_ENABLE = "disable"