瀏覽代碼

Add a couple of small but vital parts to PXENV_UDP_WRITE.

tags/v0.9.3
Michael Brown 18 年之前
父節點
當前提交
691557281f
共有 1 個檔案被更改,包括 12 行新增1 行删除
  1. 12
    1
      src/interface/pxe/pxe_udp.c

+ 12
- 1
src/interface/pxe/pxe_udp.c 查看文件

@@ -285,6 +285,7 @@ PXENV_EXIT_t pxenv_udp_write ( struct s_PXENV_UDP_WRITE *pxenv_udp_write ) {
285 285
 		struct sockaddr_in sin;
286 286
 		struct sockaddr_tcpip st;
287 287
 	} dest;
288
+	int rc;
288 289
 
289 290
 	DBG ( "PXENV_UDP_WRITE" );
290 291
 
@@ -299,6 +300,7 @@ PXENV_EXIT_t pxenv_udp_write ( struct s_PXENV_UDP_WRITE *pxenv_udp_write ) {
299 300
 	dest.sin.sin_family = AF_INET;
300 301
 	dest.sin.sin_addr.s_addr = pxenv_udp_write->ip;
301 302
 	dest.sin.sin_port = pxenv_udp_write->dst_port;
303
+	udp_connect ( &pxe_udp.udp, &dest.st );
302 304
 
303 305
 	/* Set local (source) port.  PXE spec says source port is 2069
304 306
 	 * if not specified.  Really, this ought to be set at UDP open
@@ -312,9 +314,18 @@ PXENV_EXIT_t pxenv_udp_write ( struct s_PXENV_UDP_WRITE *pxenv_udp_write ) {
312 314
 	 * confident of being able to do our own routing.  We should
313 315
 	 * probably allow for multiple gateways.
314 316
 	 */
317
+
318
+	DBG ( " %04x:%04x+%x %d->%s:%d", pxenv_udp_write->buffer.segment,
319
+	      pxenv_udp_write->buffer.offset, pxenv_udp_write->buffer_size,
320
+	      ntohs ( pxenv_udp_write->src_port ),
321
+	      inet_ntoa ( dest.sin.sin_addr ),
322
+	      ntohs ( pxenv_udp_write->dst_port ) );
315 323
 	
316 324
 	/* Transmit packet */
317
-	if ( udp_senddata ( &pxe_udp.udp ) != 0 ) {
325
+	pxe_udp.pxenv_udp_write = pxenv_udp_write;
326
+	rc = udp_senddata ( &pxe_udp.udp );
327
+	pxe_udp.pxenv_udp_write = NULL;
328
+	if ( rc != 0 ) {
318 329
 		pxenv_udp_write->Status = PXENV_STATUS_UNDI_TRANSMIT_ERROR;
319 330
 		return PXENV_EXIT_FAILURE;
320 331
 	}

Loading…
取消
儲存