Просмотр исходного кода

udp_open_promisc() calls udp_open_common() with peer==NULL.

tags/v0.9.3
Michael Brown 16 лет назад
Родитель
Сommit
423e9d72f3
1 измененных файлов: 3 добавлений и 2 удалений
  1. 3
    2
      src/net/udp.c

+ 3
- 2
src/net/udp.c Просмотреть файл

@@ -89,7 +89,7 @@ static int udp_bind ( struct udp_connection *udp, unsigned int port ) {
89 89
  * Open a UDP connection
90 90
  *
91 91
  * @v xfer		Data transfer interface
92
- * @v peer		Peer socket address
92
+ * @v peer		Peer socket address, or NULL
93 93
  * @v local		Local socket address, or NULL
94 94
  * @v promisc		Socket is promiscuous
95 95
  * @ret rc		Return status code
@@ -109,7 +109,8 @@ static int udp_open_common ( struct xfer_interface *xfer,
109 109
 		return -ENOMEM;
110 110
 	DBGC ( udp, "UDP %p allocated\n", udp );
111 111
 	xfer_init ( &udp->xfer, &udp_xfer_operations, &udp->refcnt );
112
-	memcpy ( &udp->peer, st_peer, sizeof ( udp->peer ) );
112
+	if ( st_peer )
113
+		memcpy ( &udp->peer, st_peer, sizeof ( udp->peer ) );
113 114
 
114 115
 	/* Bind to local port */
115 116
 	if ( ! promisc ) {

Загрузка…
Отмена
Сохранить