256,7 → 256,7 |
* @returns EINVAL if the packet is bigger than the device MTU. |
* @returns ENOMEM if there is not enough memory in the packet. |
*/ |
int eth_prepare_packet( int flags, packet_t packet, uint8_t * src_addr, int ethertype ); |
int eth_prepare_packet( int flags, packet_t packet, uint8_t * src_addr, int ethertype, size_t mtu ); |
|
DEVICE_MAP_IMPLEMENT( eth_devices, eth_device_t ) |
|
270,7 → 270,7 |
rwlock_read_lock( & eth_globals.protos_lock ); |
for( index = eth_protos_count( & eth_globals.protos ) - 1; index >= 0; -- index ){ |
proto = eth_protos_get_index( & eth_globals.protos, index ); |
if( proto && proto->phone ) il_device_state_msg( proto->phone, device_id, state ); |
if( proto && proto->phone ) il_device_state_msg( proto->phone, device_id, state, proto->service ); |
} |
rwlock_read_unlock( & eth_globals.protos_lock ); |
return EOK; |
535,7 → 535,7 |
return EOK; |
} |
|
int eth_prepare_packet( int flags, packet_t packet, uint8_t * src_addr, int ethertype ){ |
int eth_prepare_packet( int flags, packet_t packet, uint8_t * src_addr, int ethertype, size_t mtu ){ |
eth_header_ex_ref header; |
eth_header_ref header_dix; |
eth_fcs_ref fcs; |
550,8 → 550,7 |
if( length < 0 ) return length; |
if( length < ETH_ADDR ) return EINVAL; |
length = packet_get_data_length( packet ); |
//TODO smaller than MTU! |
if( length > ETH_MAX_TAGGED_CONTENT( flags )) return EINVAL; |
if( length > mtu ) return EINVAL; |
if( length < ETH_MIN_TAGGED_CONTENT( flags )){ |
padding = packet_suffix( packet, ETH_MIN_TAGGED_CONTENT( flags ) - length ); |
if( ! padding ) return ENOMEM; |
613,7 → 612,7 |
// process packet queue |
next = packet; |
do{ |
if( ERROR_OCCURRED( eth_prepare_packet( device->flags, next, ( uint8_t * ) device->addr->value, ethertype ))){ |
if( ERROR_OCCURRED( eth_prepare_packet( device->flags, next, ( uint8_t * ) device->addr->value, ethertype, device->mtu ))){ |
// release invalid packet |
tmp = pq_detach( next ); |
pq_release( eth_globals.net_phone, packet_get_id( next )); |