X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=lib%2Fmac-learning.c;h=3c541af2bbd846f3e8fbc34fc01098f1695f971f;hb=beffe87554210fb43be20eb23251c87e5eb4b529;hp=e0618c2e99700b991239830a6eb8918c7ef3cdd7;hpb=e764773ccb007e79f44d948a781fae1313ac28fe;p=openvswitch diff --git a/lib/mac-learning.c b/lib/mac-learning.c index e0618c2e..3c541af2 100644 --- a/lib/mac-learning.c +++ b/lib/mac-learning.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira Networks. + * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ #include "poll-loop.h" #include "tag.h" #include "timeval.h" +#include "unaligned.h" #include "util.h" #include "vlan-bitmap.h" #include "vlog.h" @@ -49,7 +50,9 @@ static uint32_t mac_table_hash(const struct mac_learning *ml, const uint8_t mac[ETH_ADDR_LEN], uint16_t vlan) { - return hash_bytes(mac, ETH_ADDR_LEN, vlan ^ ml->secret); + unsigned int mac1 = get_unaligned_u32((uint32_t *) mac); + unsigned int mac2 = get_unaligned_u16((uint16_t *) (mac + 4)); + return hash_3words(mac1, mac2 | (vlan << 16), ml->secret); } static struct mac_entry *