Browse Source

[pxe] Add extra debug messages to the PXE UDP API calls

tags/v0.9.4
Michael Brown 16 years ago
parent
commit
0ffc3f6285
1 changed files with 16 additions and 4 deletions
  1. 16
    4
      src/interface/pxe/pxe_udp.c

+ 16
- 4
src/interface/pxe/pxe_udp.c View File

@@ -166,6 +166,7 @@ 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 170
 
170 171
 	/* Open promiscuous UDP connection */
171 172
 	xfer_close ( &pxe_udp.xfer, 0 );
@@ -355,8 +356,10 @@ PXENV_EXIT_t pxenv_udp_write ( struct s_PXENV_UDP_WRITE *pxenv_udp_write ) {
355 356
  *
356 357
  */
357 358
 PXENV_EXIT_t pxenv_udp_read ( struct s_PXENV_UDP_READ *pxenv_udp_read ) {
358
-	struct in_addr dest_ip = { .s_addr = pxenv_udp_read->dest_ip };
359
-	uint16_t d_port = pxenv_udp_read->d_port;
359
+	struct in_addr dest_ip_wanted = { .s_addr = pxenv_udp_read->dest_ip };
360
+	struct in_addr dest_ip;
361
+	uint16_t d_port_wanted = pxenv_udp_read->d_port;
362
+	uint16_t d_port;
360 363
 
361 364
 	DBG ( "PXENV_UDP_READ" );
362 365
 
@@ -368,12 +371,21 @@ PXENV_EXIT_t pxenv_udp_read ( struct s_PXENV_UDP_READ *pxenv_udp_read ) {
368 371
 		pxe_udp.pxenv_udp_read = NULL;
369 372
 		goto no_packet;
370 373
 	}
374
+	dest_ip.s_addr = pxenv_udp_read->dest_ip;
375
+	d_port = pxenv_udp_read->d_port;
371 376
 
372 377
 	/* Filter on destination address and/or port */
373
-	if ( dest_ip.s_addr && ( dest_ip.s_addr != pxenv_udp_read->dest_ip ) )
378
+	if ( dest_ip_wanted.s_addr &&
379
+	     ( dest_ip_wanted.s_addr != dest_ip.s_addr ) ) {
380
+		DBG ( " wrong IP %s", inet_ntoa ( dest_ip ) );
381
+		DBG ( " (wanted %s)", inet_ntoa ( dest_ip_wanted ) );
374 382
 		goto no_packet;
375
-	if ( d_port && ( d_port != pxenv_udp_read->d_port ) )
383
+	}
384
+	if ( d_port_wanted && ( d_port_wanted != d_port ) ) {
385
+		DBG ( " wrong port %d ", htons ( d_port ) );
386
+		DBG ( " (wanted %d)", htons ( d_port_wanted ) );
376 387
 		goto no_packet;
388
+	}
377 389
 
378 390
 	DBG ( " %04x:%04x+%x %s:", pxenv_udp_read->buffer.segment,
379 391
 	      pxenv_udp_read->buffer.offset, pxenv_udp_read->buffer_size,

Loading…
Cancel
Save