|
@@ -62,19 +62,18 @@ int tcpip_rx ( struct io_buffer *iobuf, struct net_device *netdev,
|
62
|
62
|
/**
|
63
|
63
|
* Find TCP/IP network-layer protocol
|
64
|
64
|
*
|
65
|
|
- * @v st_dest Destination address
|
|
65
|
+ * @v sa_family Address family
|
66
|
66
|
* @ret tcpip_net TCP/IP network-layer protocol, or NULL if not found
|
67
|
67
|
*/
|
68
|
|
-static struct tcpip_net_protocol *
|
69
|
|
-tcpip_net_protocol ( struct sockaddr_tcpip *st_dest ) {
|
|
68
|
+struct tcpip_net_protocol * tcpip_net_protocol ( sa_family_t sa_family ) {
|
70
|
69
|
struct tcpip_net_protocol *tcpip_net;
|
71
|
70
|
|
72
|
71
|
for_each_table_entry ( tcpip_net, TCPIP_NET_PROTOCOLS ) {
|
73
|
|
- if ( tcpip_net->sa_family == st_dest->st_family )
|
|
72
|
+ if ( tcpip_net->sa_family == sa_family )
|
74
|
73
|
return tcpip_net;
|
75
|
74
|
}
|
76
|
75
|
|
77
|
|
- DBG ( "Unrecognised TCP/IP address family %d\n", st_dest->st_family );
|
|
76
|
+ DBG ( "Unrecognised TCP/IP address family %d\n", sa_family );
|
78
|
77
|
return NULL;
|
79
|
78
|
}
|
80
|
79
|
|
|
@@ -95,7 +94,7 @@ int tcpip_tx ( struct io_buffer *iobuf, struct tcpip_protocol *tcpip_protocol,
|
95
|
94
|
struct tcpip_net_protocol *tcpip_net;
|
96
|
95
|
|
97
|
96
|
/* Hand off packet to the appropriate network-layer protocol */
|
98
|
|
- tcpip_net = tcpip_net_protocol ( st_dest );
|
|
97
|
+ tcpip_net = tcpip_net_protocol ( st_dest->st_family );
|
99
|
98
|
if ( tcpip_net ) {
|
100
|
99
|
DBG ( "TCP/IP sending %s packet\n", tcpip_net->name );
|
101
|
100
|
return tcpip_net->tx ( iobuf, tcpip_protocol, st_src, st_dest,
|
|
@@ -116,7 +115,7 @@ struct net_device * tcpip_netdev ( struct sockaddr_tcpip *st_dest ) {
|
116
|
115
|
struct tcpip_net_protocol *tcpip_net;
|
117
|
116
|
|
118
|
117
|
/* Hand off to the appropriate network-layer protocol */
|
119
|
|
- tcpip_net = tcpip_net_protocol ( st_dest );
|
|
118
|
+ tcpip_net = tcpip_net_protocol ( st_dest->st_family );
|
120
|
119
|
if ( tcpip_net )
|
121
|
120
|
return tcpip_net->netdev ( st_dest );
|
122
|
121
|
|
|
@@ -135,7 +134,7 @@ size_t tcpip_mtu ( struct sockaddr_tcpip *st_dest ) {
|
135
|
134
|
size_t mtu;
|
136
|
135
|
|
137
|
136
|
/* Find appropriate network-layer protocol */
|
138
|
|
- tcpip_net = tcpip_net_protocol ( st_dest );
|
|
137
|
+ tcpip_net = tcpip_net_protocol ( st_dest->st_family );
|
139
|
138
|
if ( ! tcpip_net )
|
140
|
139
|
return 0;
|
141
|
140
|
|