|
@@ -14,8 +14,10 @@ static int test_dhcp_aoe_boot ( struct net_device *netdev,
|
14
|
14
|
return test_aoeboot ( netdev, aoename, drivenum );
|
15
|
15
|
}
|
16
|
16
|
|
17
|
|
-static int test_dhcp_iscsi_boot ( struct net_device *netdev, char *iscsiname ) {
|
18
|
|
- char *initiator_iqn = "iqn.1900-01.localdomain.localhost:initiator";
|
|
17
|
+static int test_dhcp_iscsi_boot ( struct net_device *netdev,
|
|
18
|
+ char *iscsiname ) {
|
|
19
|
+ char initiator_iqn_buf[32];
|
|
20
|
+ char *initiator_iqn = initiator_iqn_buf;
|
19
|
21
|
char username[32];
|
20
|
22
|
char password[32];
|
21
|
23
|
char *target_iqn;
|
|
@@ -24,6 +26,7 @@ static int test_dhcp_iscsi_boot ( struct net_device *netdev, char *iscsiname ) {
|
24
|
26
|
struct sockaddr_tcpip st;
|
25
|
27
|
} target;
|
26
|
28
|
unsigned int drivenum;
|
|
29
|
+ struct dhcp_option *option;
|
27
|
30
|
|
28
|
31
|
memset ( &target, 0, sizeof ( target ) );
|
29
|
32
|
target.sin.sin_family = AF_INET;
|
|
@@ -36,6 +39,10 @@ static int test_dhcp_iscsi_boot ( struct net_device *netdev, char *iscsiname ) {
|
36
|
39
|
}
|
37
|
40
|
inet_aton ( iscsiname, &target.sin.sin_addr );
|
38
|
41
|
|
|
42
|
+ dhcp_snprintf ( initiator_iqn, sizeof ( initiator_iqn ),
|
|
43
|
+ find_global_dhcp_option ( DHCP_ISCSI_INITIATOR_IQN ) );
|
|
44
|
+ if ( ! *initiator_iqn )
|
|
45
|
+ initiator_iqn = "iqn.1900-01.localdomain.localhost:initiator";
|
39
|
46
|
dhcp_snprintf ( username, sizeof ( username ),
|
40
|
47
|
find_global_dhcp_option ( DHCP_EB_USERNAME ) );
|
41
|
48
|
dhcp_snprintf ( password, sizeof ( password ),
|
|
@@ -89,6 +96,29 @@ static int test_dhcp_http ( struct net_device *netdev, char *url ) {
|
89
|
96
|
return 0;
|
90
|
97
|
}
|
91
|
98
|
|
|
99
|
+static int test_dhcp_ftp ( struct net_device *netdev, char *ftpname ) {
|
|
100
|
+ union {
|
|
101
|
+ struct sockaddr_in sin;
|
|
102
|
+ struct sockaddr_tcpip st;
|
|
103
|
+ } target;
|
|
104
|
+ char *filename;
|
|
105
|
+
|
|
106
|
+ filename = strchr ( ftpname, ':' );
|
|
107
|
+ if ( ! filename ) {
|
|
108
|
+ printf ( "Invalid FTP path \"%s\"\n", ftpname );
|
|
109
|
+ return -EINVAL;
|
|
110
|
+ }
|
|
111
|
+ *filename++ = '\0';
|
|
112
|
+
|
|
113
|
+ memset ( &target, 0, sizeof ( target ) );
|
|
114
|
+ target.sin.sin_family = AF_INET;
|
|
115
|
+ target.sin.sin_port = htons ( 21 );
|
|
116
|
+ inet_aton ( ftpname, &target.sin.sin_addr );
|
|
117
|
+
|
|
118
|
+ test_ftp ( &target, filename );
|
|
119
|
+ return 0;
|
|
120
|
+}
|
|
121
|
+
|
92
|
122
|
static int test_dhcp_tftp ( struct net_device *netdev, char *tftpname ) {
|
93
|
123
|
union {
|
94
|
124
|
struct sockaddr_in sin;
|
|
@@ -105,17 +135,27 @@ static int test_dhcp_tftp ( struct net_device *netdev, char *tftpname ) {
|
105
|
135
|
}
|
106
|
136
|
|
107
|
137
|
static int test_dhcp_boot ( struct net_device *netdev, char *filename ) {
|
|
138
|
+ /*
|
108
|
139
|
if ( strncmp ( filename, "aoe:", 4 ) == 0 ) {
|
109
|
140
|
return test_dhcp_aoe_boot ( netdev, &filename[4] );
|
110
|
|
- } else if ( strncmp ( filename, "iscsi:", 6 ) == 0 ) {
|
|
141
|
+ }
|
|
142
|
+ */
|
|
143
|
+ if ( strncmp ( filename, "iscsi:", 6 ) == 0 ) {
|
111
|
144
|
return test_dhcp_iscsi_boot ( netdev, &filename[6] );
|
112
|
|
- } else if ( strncmp ( filename, "hello:", 6 ) == 0 ) {
|
|
145
|
+ }
|
|
146
|
+ if ( strncmp ( filename, "ftp:", 4 ) == 0 ) {
|
|
147
|
+ return test_dhcp_ftp ( netdev, &filename[4] );
|
|
148
|
+ }
|
|
149
|
+ /*
|
|
150
|
+ if ( strncmp ( filename, "hello:", 6 ) == 0 ) {
|
113
|
151
|
return test_dhcp_hello ( &filename[6] );
|
114
|
|
- } else if ( strncmp ( filename, "http:", 5 ) == 0 ) {
|
|
152
|
+ }
|
|
153
|
+ if ( strncmp ( filename, "http:", 5 ) == 0 ) {
|
115
|
154
|
return test_dhcp_http ( netdev, filename );
|
116
|
|
- } else {
|
117
|
|
- return test_dhcp_tftp ( netdev, filename );
|
118
|
155
|
}
|
|
156
|
+ return test_dhcp_tftp ( netdev, filename );
|
|
157
|
+ */
|
|
158
|
+ return -EPROTONOSUPPORT;
|
119
|
159
|
}
|
120
|
160
|
|
121
|
161
|
int test_dhcp ( struct net_device *netdev ) {
|