[tcpip] Pass through network device to transport layer protocols

NDP requires knowledge of the network device on which a packet was
received.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2013-09-01 20:55:18 +01:00
parent 8a2dc7a588
commit 6bf36f57a0
8 changed files with 26 additions and 13 deletions

View File

@@ -20,6 +20,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
/** Process a received TCP/IP packet
*
* @v iobuf I/O buffer
* @v netdev Network device
* @v tcpip_proto Transport-layer protocol number
* @v st_src Partially-filled source address
* @v st_dest Partially-filled destination address
@@ -32,8 +33,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
* address family and the network-layer addresses, but leave the ports
* and the rest of the structures as zero).
*/
int tcpip_rx ( struct io_buffer *iobuf, uint8_t tcpip_proto,
struct sockaddr_tcpip *st_src,
int tcpip_rx ( struct io_buffer *iobuf, struct net_device *netdev,
uint8_t tcpip_proto, struct sockaddr_tcpip *st_src,
struct sockaddr_tcpip *st_dest,
uint16_t pshdr_csum ) {
struct tcpip_protocol *tcpip;
@@ -42,7 +43,8 @@ int tcpip_rx ( struct io_buffer *iobuf, uint8_t tcpip_proto,
for_each_table_entry ( tcpip, TCPIP_PROTOCOLS ) {
if ( tcpip->tcpip_proto == tcpip_proto ) {
DBG ( "TCP/IP received %s packet\n", tcpip->name );
return tcpip->rx ( iobuf, st_src, st_dest, pshdr_csum );
return tcpip->rx ( iobuf, netdev, st_src, st_dest,
pshdr_csum );
}
}