Rev 4075 | Rev 4153 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4075 | Rev 4077 | ||
|---|---|---|---|
| Line 245... | Line 245... | ||
| 245 | }else{ |
245 | }else{ |
| 246 | // invalid length/type, should not occurr |
246 | // invalid length/type, should not occurr |
| 247 | return NULL; |
247 | return NULL; |
| 248 | } |
248 | } |
| 249 | // TODO compute crc with fcs to erase? |
249 | // TODO compute crc with fcs to erase? |
| 250 | if(( ~ compute_crc32( ~ 0, & header->header.dest, ((( void * ) fcs ) - (( void * ) & header->header.dest )) * 8 )) != ( * fcs )){ |
250 | if(( ~ compute_crc32( ~ 0, & header->header.dest, ((( void * ) fcs ) - (( void * ) & header->header.dest )) * 8 )) != ntohl( * fcs )){ |
| 251 | return NULL; |
251 | return NULL; |
| 252 | } |
252 | } |
| 253 | if( ERROR_OCCURRED( packet_set_addr( packet, header->header.src, header->header.dest, ETH_ADDR )) |
253 | if( ERROR_OCCURRED( packet_set_addr( packet, header->header.src, header->header.dest, ETH_ADDR )) |
| 254 | || ERROR_OCCURRED( packet_trim( packet, prefix, suffix ))){ |
254 | || ERROR_OCCURRED( packet_trim( packet, prefix, suffix ))){ |
| 255 | return NULL; |
255 | return NULL; |
| Line 378... | Line 378... | ||
| 378 | header->lsap.ctrl = 0; |
378 | header->lsap.ctrl = 0; |
| 379 | for( i = 0; i < 3; ++ i ) header->snap.proto[ i ] = 0; |
379 | for( i = 0; i < 3; ++ i ) header->snap.proto[ i ] = 0; |
| 380 | header->snap.ethertype = ethertype; |
380 | header->snap.ethertype = ethertype; |
| 381 | fcs = PACKET_SUFFIX( packet, eth_fcs_t ); |
381 | fcs = PACKET_SUFFIX( packet, eth_fcs_t ); |
| 382 | if( ! fcs ) return ENOMEM; |
382 | if( ! fcs ) return ENOMEM; |
| 383 | * fcs = ~ compute_crc32( ~ 0, & header->header.dest, ((( void * ) fcs ) - (( void * ) & header->header.dest )) * 8 ); |
383 | * fcs = htonl( ~ compute_crc32( ~ 0, & header->header.dest, ((( void * ) fcs ) - (( void * ) & header->header.dest )) * 8 )); |
| 384 | return EOK; |
384 | return EOK; |
| 385 | } |
385 | } |
| 386 | 386 | ||
| 387 | int eth_send_message( device_id_t device_id, packet_t packet, services_t sender ){ |
387 | int eth_send_message( device_id_t device_id, packet_t packet, services_t sender ){ |
| 388 | ERROR_DECLARE; |
388 | ERROR_DECLARE; |