1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## 22_ifdown_kfreebsd.dpatch mostly by Robert Millan
4
## All lines beginning with `## DP:' are a description of the patch.
5
## DP: Get ifdown working on kFreeBSD. (Closes: #327031)
8
diff -urNad sysvinit-2.86.ds1~/src/ifdown.c sysvinit-2.86.ds1/src/ifdown.c
9
--- sysvinit-2.86.ds1~/src/ifdown.c 2008-04-17 15:49:43.000000000 +0200
10
+++ sysvinit-2.86.ds1/src/ifdown.c 2008-04-17 15:57:16.000000000 +0200
13
if (strchr(ifr[i].ifr_name, ':') != NULL)
15
- ifr[i].ifr_flags &= ~(IFF_UP);
16
- if (ioctl(fd, SIOCSIFFLAGS, &ifr[i]) < 0) {
17
+/* Expected in <net/if.h> according to "UNIX Network Programming". */
19
+#define FLAGS ifr_flags
21
+/* Present on kFreeBSD, fixes bug #327031. */
22
+#define FLAGS ifr_flagshigh
24
+ /* Read interface flags */
25
+ if (ioctl(fd, SIOCGIFFLAGS, &ifr[i]) < 0) {
26
fprintf(stderr, "ifdown: shutdown ");
27
perror(ifr[i].ifr_name);
30
+ if (ifr[i].FLAGS & IFF_UP) {
31
+ ifr[i].FLAGS &= ~(IFF_UP);
32
+ if (ioctl(fd, SIOCSIFFLAGS, &ifr[i]) < 0) {
33
+ fprintf(stderr, "ifdown: shutdown ");
34
+ perror(ifr[i].ifr_name);