|
@@ -166,11 +166,13 @@ PXENV_EXIT_t pxenv_udp_open ( struct s_PXENV_UDP_OPEN *pxenv_udp_open ) {
|
166
|
166
|
|
167
|
167
|
/* Record source IP address */
|
168
|
168
|
pxe_udp.local.sin_addr.s_addr = pxenv_udp_open->src_ip;
|
169
|
|
- DBG ( " %s", inet_ntoa ( pxe_udp.local.sin_addr ) );
|
|
169
|
+ DBG ( " %s\n", inet_ntoa ( pxe_udp.local.sin_addr ) );
|
170
|
170
|
|
171
|
171
|
/* Open promiscuous UDP connection */
|
172
|
172
|
intf_restart ( &pxe_udp.xfer, 0 );
|
173
|
173
|
if ( ( rc = udp_open_promisc ( &pxe_udp.xfer ) ) != 0 ) {
|
|
174
|
+ DBG ( "PXENV_UDP_OPEN could not open promiscuous socket: %s\n",
|
|
175
|
+ strerror ( rc ) );
|
174
|
176
|
pxenv_udp_open->Status = PXENV_STATUS ( rc );
|
175
|
177
|
return PXENV_EXIT_FAILURE;
|
176
|
178
|
}
|
|
@@ -201,7 +203,7 @@ PXENV_EXIT_t pxenv_udp_open ( struct s_PXENV_UDP_OPEN *pxenv_udp_open ) {
|
201
|
203
|
*
|
202
|
204
|
*/
|
203
|
205
|
PXENV_EXIT_t pxenv_udp_close ( struct s_PXENV_UDP_CLOSE *pxenv_udp_close ) {
|
204
|
|
- DBG ( "PXENV_UDP_CLOSE" );
|
|
206
|
+ DBG ( "PXENV_UDP_CLOSE\n" );
|
205
|
207
|
|
206
|
208
|
/* Close UDP connection */
|
207
|
209
|
intf_restart ( &pxe_udp.xfer, 0 );
|
|
@@ -288,6 +290,7 @@ PXENV_EXIT_t pxenv_udp_write ( struct s_PXENV_UDP_WRITE *pxenv_udp_write ) {
|
288
|
290
|
len = pxenv_udp_write->buffer_size;
|
289
|
291
|
iobuf = xfer_alloc_iob ( &pxe_udp.xfer, len );
|
290
|
292
|
if ( ! iobuf ) {
|
|
293
|
+ DBG ( " out of memory\n" );
|
291
|
294
|
pxenv_udp_write->Status = PXENV_STATUS_OUT_OF_RESOURCES;
|
292
|
295
|
return PXENV_EXIT_FAILURE;
|
293
|
296
|
}
|
|
@@ -295,7 +298,7 @@ PXENV_EXIT_t pxenv_udp_write ( struct s_PXENV_UDP_WRITE *pxenv_udp_write ) {
|
295
|
298
|
pxenv_udp_write->buffer.offset );
|
296
|
299
|
copy_from_user ( iob_put ( iobuf, len ), buffer, 0, len );
|
297
|
300
|
|
298
|
|
- DBG ( " %04x:%04x+%x %d->%s:%d", pxenv_udp_write->buffer.segment,
|
|
301
|
+ DBG ( " %04x:%04x+%x %d->%s:%d\n", pxenv_udp_write->buffer.segment,
|
299
|
302
|
pxenv_udp_write->buffer.offset, pxenv_udp_write->buffer_size,
|
300
|
303
|
ntohs ( pxenv_udp_write->src_port ),
|
301
|
304
|
inet_ntoa ( dest.sin_addr ),
|
|
@@ -303,6 +306,8 @@ PXENV_EXIT_t pxenv_udp_write ( struct s_PXENV_UDP_WRITE *pxenv_udp_write ) {
|
303
|
306
|
|
304
|
307
|
/* Transmit packet */
|
305
|
308
|
if ( ( rc = xfer_deliver ( &pxe_udp.xfer, iobuf, &meta ) ) != 0 ) {
|
|
309
|
+ DBG ( "PXENV_UDP_WRITE could not transmit: %s\n",
|
|
310
|
+ strerror ( rc ) );
|
306
|
311
|
pxenv_udp_write->Status = PXENV_STATUS ( rc );
|
307
|
312
|
return PXENV_EXIT_FAILURE;
|
308
|
313
|
}
|
|
@@ -360,36 +365,36 @@ PXENV_EXIT_t pxenv_udp_read ( struct s_PXENV_UDP_READ *pxenv_udp_read ) {
|
360
|
365
|
uint16_t d_port_wanted = pxenv_udp_read->d_port;
|
361
|
366
|
uint16_t d_port;
|
362
|
367
|
|
363
|
|
- DBG ( "PXENV_UDP_READ" );
|
364
|
|
-
|
365
|
368
|
/* Try receiving a packet */
|
366
|
369
|
pxe_udp.pxenv_udp_read = pxenv_udp_read;
|
367
|
370
|
step();
|
368
|
371
|
if ( pxe_udp.pxenv_udp_read ) {
|
369
|
372
|
/* No packet received */
|
|
373
|
+ DBG2 ( "PXENV_UDP_READ\n" );
|
370
|
374
|
pxe_udp.pxenv_udp_read = NULL;
|
371
|
375
|
goto no_packet;
|
372
|
376
|
}
|
373
|
377
|
dest_ip.s_addr = pxenv_udp_read->dest_ip;
|
374
|
378
|
d_port = pxenv_udp_read->d_port;
|
|
379
|
+ DBG ( "PXENV_UDP_READ" );
|
375
|
380
|
|
376
|
381
|
/* Filter on destination address and/or port */
|
377
|
382
|
if ( dest_ip_wanted.s_addr &&
|
378
|
383
|
( dest_ip_wanted.s_addr != dest_ip.s_addr ) ) {
|
379
|
384
|
DBG ( " wrong IP %s", inet_ntoa ( dest_ip ) );
|
380
|
|
- DBG ( " (wanted %s)", inet_ntoa ( dest_ip_wanted ) );
|
|
385
|
+ DBG ( " (wanted %s)\n", inet_ntoa ( dest_ip_wanted ) );
|
381
|
386
|
goto no_packet;
|
382
|
387
|
}
|
383
|
388
|
if ( d_port_wanted && ( d_port_wanted != d_port ) ) {
|
384
|
|
- DBG ( " wrong port %d ", htons ( d_port ) );
|
385
|
|
- DBG ( " (wanted %d)", htons ( d_port_wanted ) );
|
|
389
|
+ DBG ( " wrong port %d", htons ( d_port ) );
|
|
390
|
+ DBG ( " (wanted %d)\n", htons ( d_port_wanted ) );
|
386
|
391
|
goto no_packet;
|
387
|
392
|
}
|
388
|
393
|
|
389
|
394
|
DBG ( " %04x:%04x+%x %s:", pxenv_udp_read->buffer.segment,
|
390
|
395
|
pxenv_udp_read->buffer.offset, pxenv_udp_read->buffer_size,
|
391
|
396
|
inet_ntoa ( *( ( struct in_addr * ) &pxenv_udp_read->src_ip ) ));
|
392
|
|
- DBG ( "%d<-%s:%d", ntohs ( pxenv_udp_read->s_port ),
|
|
397
|
+ DBG ( "%d<-%s:%d\n", ntohs ( pxenv_udp_read->s_port ),
|
393
|
398
|
inet_ntoa ( *( ( struct in_addr * ) &pxenv_udp_read->dest_ip ) ),
|
394
|
399
|
ntohs ( pxenv_udp_read->d_port ) );
|
395
|
400
|
|