Lines 1-6
Link Here
|
1 |
--- isboot.c.orig 2015-11-05 16:50:51 UTC |
1 |
--- isboot.c.orig 2015-11-05 16:50:51 UTC |
2 |
+++ isboot.c |
2 |
+++ isboot.c |
3 |
@@ -347,9 +347,9 @@ isboot_set_v4gw(struct sockaddr_in *gate |
3 |
@@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); |
|
|
4 |
|
5 |
#include <sys/param.h> |
6 |
#include <sys/kernel.h> |
7 |
+#include <sys/proc.h> |
8 |
#include <sys/module.h> |
9 |
#include <sys/endian.h> |
10 |
#include <sys/systm.h> |
11 |
@@ -347,9 +348,9 @@ isboot_set_v4gw(struct sockaddr_in *gateway) |
4 |
netmask.sin_addr.s_addr = htonl(0); |
12 |
netmask.sin_addr.s_addr = htonl(0); |
5 |
|
13 |
|
6 |
/* delete gateway if exists */ |
14 |
/* delete gateway if exists */ |
Lines 12-18
Link Here
|
12 |
if (error) { |
20 |
if (error) { |
13 |
if (error != ESRCH) { |
21 |
if (error != ESRCH) { |
14 |
printf("rtrequest RTM_DELETE error %d\n", |
22 |
printf("rtrequest RTM_DELETE error %d\n", |
15 |
@@ -359,9 +359,9 @@ isboot_set_v4gw(struct sockaddr_in *gate |
23 |
@@ -359,9 +360,9 @@ isboot_set_v4gw(struct sockaddr_in *gateway) |
16 |
} |
24 |
} |
17 |
|
25 |
|
18 |
/* set new default gateway */ |
26 |
/* set new default gateway */ |
Lines 24-30
Link Here
|
24 |
if (error) { |
32 |
if (error) { |
25 |
printf("rtrequest RTM_ADD error %d\n", error); |
33 |
printf("rtrequest RTM_ADD error %d\n", error); |
26 |
return (error); |
34 |
return (error); |
27 |
@@ -391,9 +391,9 @@ isboot_set_v6gw(struct sockaddr_in6 *gat |
35 |
@@ -391,9 +392,9 @@ isboot_set_v6gw(struct sockaddr_in6 *gateway) |
28 |
memset(&netmask.sin6_addr, 0, 16); |
36 |
memset(&netmask.sin6_addr, 0, 16); |
29 |
|
37 |
|
30 |
/* delete gateway if exists */ |
38 |
/* delete gateway if exists */ |
Lines 36-42
Link Here
|
36 |
if (error) { |
44 |
if (error) { |
37 |
if (error != ESRCH) { |
45 |
if (error != ESRCH) { |
38 |
printf("rtrequest RTM_DELETE error %d\n", |
46 |
printf("rtrequest RTM_DELETE error %d\n", |
39 |
@@ -403,9 +403,9 @@ isboot_set_v6gw(struct sockaddr_in6 *gat |
47 |
@@ -403,9 +404,9 @@ isboot_set_v6gw(struct sockaddr_in6 *gateway) |
40 |
} |
48 |
} |
41 |
|
49 |
|
42 |
/* set new default gateway */ |
50 |
/* set new default gateway */ |
Lines 48-50
Link Here
|
48 |
if (error) { |
56 |
if (error) { |
49 |
printf("rtrequest RTM_ADD error %d\n", error); |
57 |
printf("rtrequest RTM_ADD error %d\n", error); |
50 |
return (error); |
58 |
return (error); |
|
|
59 |
@@ -416,29 +417,36 @@ isboot_set_v6gw(struct sockaddr_in6 *gateway) |
60 |
static int |
61 |
isboot_ifup(struct ifnet *ifp) |
62 |
{ |
63 |
+ struct socket *so; |
64 |
struct ifreq ifr; |
65 |
struct thread *td; |
66 |
int error; |
67 |
|
68 |
- memset(&ifr, 0, sizeof(ifr)); |
69 |
td = curthread; |
70 |
+ error = socreate(AF_INET, &so, SOCK_DGRAM, 0, td->td_ucred, td); |
71 |
+ if (error) { |
72 |
+ printf("%s: socreate, error=%d\n", __func__, error); |
73 |
+ return (error); |
74 |
+ } |
75 |
|
76 |
/* boot NIC */ |
77 |
+ memset(&ifr, 0, sizeof(ifr)); |
78 |
strlcpy(ifr.ifr_name, ifp->if_xname, sizeof(ifr.ifr_name)); |
79 |
|
80 |
/* set IFF_UP */ |
81 |
- error = ifioctl(NULL, SIOCGIFFLAGS, (caddr_t)&ifr, td); |
82 |
+ error = ifioctl(so, SIOCGIFFLAGS, (caddr_t)&ifr, td); |
83 |
if (error) { |
84 |
- printf("ifioctl SIOCGIFFLAGS\n"); |
85 |
+ printf("%s: ifioctl SIOCGIFFLAGS, error=%d\n", __func__, error); |
86 |
return (error); |
87 |
} |
88 |
+ |
89 |
ifr.ifr_flags |= IFF_UP; |
90 |
- error = ifioctl(NULL, SIOCSIFFLAGS, (caddr_t)&ifr, td); |
91 |
+ error = ifioctl(so, SIOCSIFFLAGS, (caddr_t)&ifr, td); |
92 |
if (error) { |
93 |
- printf("ifioctl SIOCSIFFLAGS\n"); |
94 |
+ printf("%s, ifioctl SIOCSIFFLAGS, error=%d\n", __func__, error); |
95 |
return (error); |
96 |
} |
97 |
- |
98 |
+ soclose(so); |
99 |
return (0); |
100 |
} |
101 |
|