aboutsummaryrefslogtreecommitdiff
path: root/src/net/ipv4.c
diff options
context:
space:
mode:
authorMichael Brown <mcb30@etherboot.org>2008-10-15 02:00:44 +0100
committerMichael Brown <mcb30@etherboot.org>2008-10-16 05:12:56 +0100
commit6b9cc2555688e716387c02ecfe4569d2a73a7208 (patch)
tree74e96e3ee8ad06e20fe550456033e42a52ae6baf /src/net/ipv4.c
parent832668105e22c42f965970078124cdc2c556ac0d (diff)
downloadipxe-6b9cc2555688e716387c02ecfe4569d2a73a7208.zip
ipxe-6b9cc2555688e716387c02ecfe4569d2a73a7208.tar.gz
ipxe-6b9cc2555688e716387c02ecfe4569d2a73a7208.tar.bz2
[netdevice] Split multicast hashing out into an mc_hash method
Multicast hashing is an ugly overlap between network and link layers. EFI requires us to provide access to this functionality, so move it out of ipv4.c and expose it as a method of the link layer.
Diffstat (limited to 'src/net/ipv4.c')
-rw-r--r--src/net/ipv4.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/src/net/ipv4.c b/src/net/ipv4.c
index 82a13c3..e14ed6a 100644
--- a/src/net/ipv4.c
+++ b/src/net/ipv4.c
@@ -266,7 +266,6 @@ static uint16_t ipv4_pshdr_chksum ( struct io_buffer *iobuf, uint16_t csum ) {
static int ipv4_ll_addr ( struct in_addr dest, struct in_addr src,
struct net_device *netdev, uint8_t *ll_dest ) {
struct ll_protocol *ll_protocol = netdev->ll_protocol;
- uint8_t *dest_bytes = ( ( uint8_t * ) &dest );
if ( dest.s_addr == INADDR_BROADCAST ) {
/* Broadcast address */
@@ -274,17 +273,7 @@ static int ipv4_ll_addr ( struct in_addr dest, struct in_addr src,
ll_protocol->ll_addr_len );
return 0;
} else if ( IN_MULTICAST ( ntohl ( dest.s_addr ) ) ) {
- /* Special case: IPv4 multicast over Ethernet. This
- * code may need to be generalised once we find out
- * what happens for other link layers.
- */
- ll_dest[0] = 0x01;
- ll_dest[1] = 0x00;
- ll_dest[2] = 0x5e;
- ll_dest[3] = dest_bytes[1] & 0x7f;
- ll_dest[4] = dest_bytes[2];
- ll_dest[5] = dest_bytes[3];
- return 0;
+ return ll_protocol->mc_hash ( AF_INET, &dest, ll_dest );
} else {
/* Unicast address: resolve via ARP */
return arp_resolve ( netdev, &ipv4_protocol, &dest,