ia64/xen-unstable
changeset 808:3f26e93f5e01
bitkeeper revision 1.497 (3f851fdaCPqNEDqwqkVC4gYJpCZ0pg)
dev.c:
Allow arbitrary ethernet protocols to transfer between physical network and DOM0,VIF0.
dev.c:
Allow arbitrary ethernet protocols to transfer between physical network and DOM0,VIF0.
author | kaf24@scramble.cl.cam.ac.uk |
---|---|
date | Thu Oct 09 08:44:10 2003 +0000 (2003-10-09) |
parents | 6ef75cc014dc |
children | 79012ba592c9 |
files | xen/net/dev.c |
line diff
1.1 --- a/xen/net/dev.c Wed Oct 08 14:15:08 2003 +0000 1.2 +++ b/xen/net/dev.c Thu Oct 09 08:44:10 2003 +0000 1.3 @@ -1800,20 +1800,28 @@ int __init net_dev_init(void) 1.4 return 0; 1.5 } 1.6 1.7 -inline int init_tx_header(u8 *data, unsigned int len, struct net_device *dev) 1.8 +inline int init_tx_header(net_vif_t *vif, u8 *data, 1.9 + unsigned int len, struct net_device *dev) 1.10 { 1.11 + int proto = ntohs(*(unsigned short *)(data + 12)); 1.12 + 1.13 memcpy(data + ETH_ALEN, dev->dev_addr, ETH_ALEN); 1.14 1.15 - switch ( ntohs(*(unsigned short *)(data + 12)) ) 1.16 + switch ( proto ) 1.17 { 1.18 case ETH_P_ARP: 1.19 if ( len < 42 ) break; 1.20 memcpy(data + 22, dev->dev_addr, ETH_ALEN); 1.21 - return ETH_P_ARP; 1.22 + break; 1.23 case ETH_P_IP: 1.24 - return ETH_P_IP; 1.25 + break; 1.26 + default: 1.27 + /* Unsupported protocols are onyl allowed to/from VIF0/0. */ 1.28 + if ( (vif->domain->domain != 0) || (vif->idx != 0) ) 1.29 + proto = 0; 1.30 + break; 1.31 } 1.32 - return 0; 1.33 + return proto; 1.34 } 1.35 1.36 1.37 @@ -1884,7 +1892,7 @@ static int get_tx_bufs(net_vif_t *vif) 1.38 g_data = map_domain_mem(tx.addr); 1.39 1.40 protocol = __constant_htons( 1.41 - init_tx_header(g_data, tx.size, the_dev)); 1.42 + init_tx_header(vif, g_data, tx.size, the_dev)); 1.43 if ( protocol == 0 ) 1.44 { 1.45 __make_tx_response(vif, tx.id, RING_STATUS_BAD_PAGE);