File: zcip-netbsd.patch

package info (click to toggle)
zcip 4-7
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 188 kB
  • ctags: 57
  • sloc: ansic: 1,004; makefile: 39
file content (49 lines) | stat: -rw-r--r-- 1,090 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
--- zcip.c	2002-06-17 07:38:32.000000000 -0400
+++ zcip.c.new	2002-07-31 19:04:29.000000000 -0400
@@ -19,7 +19,11 @@
 #include <errno.h>
 #include <stdarg.h>
 #include <stddef.h>
+#ifdef _BSD
+#include <inttypes.h>
+#else
 #include <stdint.h>
+#endif
 #include <stdio.h>
 
 
@@ -40,7 +44,12 @@
 
 #include <arpa/inet.h>
 
+#ifdef _BSD
+#define ETH_ALEN ETHER_ADDR_LEN
+#include <netinet/ip_compat.h>
+#else
 #include <net/ethernet.h>
+#endif
 #include <net/if.h>
 #include <net/if_arp.h>
 #include <net/route.h>
@@ -598,12 +607,20 @@
     memset(&rte, 0, sizeof(rte));
 
     // destination: 0.0.0.0
+#ifdef _BSD
+    (rt_key(&rte))->sa_family = AF_INET;
+    ((struct sockaddr_in *)rt_key(&rte))->sin_addr = tmp_ip;
+#else
     rte.rt_dst.sa_family = AF_INET;
     ((struct sockaddr_in *)&rte.rt_dst)->sin_addr = tmp_ip;
+#endif
 
     rte.rt_flags = RTF_UP;
-
+#ifdef _BSD
+    strcpy(rte.rt_ifp->if_xname,this_if->if_name);
+#else
     rte.rt_dev = this_if->if_name;
+#endif
     
     r = ioctl(sock_fd, SIOCADDRT, &rte);
     if (r < 0) die("SIOCSADDRT error: %s\n", strerror(errno));