Index: stable/10/sys/ofed/include/linux/etherdevice.h =================================================================== --- stable/10/sys/ofed/include/linux/etherdevice.h (revision 302270) +++ stable/10/sys/ofed/include/linux/etherdevice.h (revision 302271) @@ -1,146 +1,147 @@ /*- * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2014 Mellanox Technologies, Ltd. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef _LINUX_ETHERDEVICE #define _LINUX_ETHERDEVICE #include #include #include #define ETH_MODULE_SFF_8079 1 #define ETH_MODULE_SFF_8079_LEN 256 #define ETH_MODULE_SFF_8472 2 #define ETH_MODULE_SFF_8472_LEN 512 #define ETH_MODULE_SFF_8636 3 #define ETH_MODULE_SFF_8636_LEN 256 #define ETH_MODULE_SFF_8436 4 #define ETH_MODULE_SFF_8436_LEN 256 struct ethtool_eeprom { u32 offset; u32 len; }; struct ethtool_modinfo { u32 type; u32 eeprom_len; }; /** * is_zero_ether_addr - Determine if give Ethernet address is all zeros. * @addr: Pointer to a six-byte array containing the Ethernet address * * Return true if the address is all zeroes. */ static inline bool is_zero_ether_addr(const u8 *addr) { return !(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]); } /** * is_multicast_ether_addr - Determine if the Ethernet address is a multicast. * @addr: Pointer to a six-byte array containing the Ethernet address * * Return true if the address is a multicast address. * By definition the broadcast address is also a multicast address. */ static inline bool is_multicast_ether_addr(const u8 *addr) { return (0x01 & addr[0]); } /** * is_broadcast_ether_addr - Determine if the Ethernet address is broadcast * @addr: Pointer to a six-byte array containing the Ethernet address * * Return true if the address is the broadcast address. */ static inline bool is_broadcast_ether_addr(const u8 *addr) { return (addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) == 0xff; } /** * is_valid_ether_addr - Determine if the given Ethernet address is valid * @addr: Pointer to a six-byte array containing the Ethernet address * * Check that the Ethernet address (MAC) is not 00:00:00:00:00:00, is not * a multicast address, and is not FF:FF:FF:FF:FF:FF. * * Return true if the address is valid. **/ static inline bool is_valid_ether_addr(const u8 *addr) { /* FF:FF:FF:FF:FF:FF is a multicast address so we don't need to ** explicitly check for it here. */ return !is_multicast_ether_addr(addr) && !is_zero_ether_addr(addr); } static inline void ether_addr_copy(u8 *dst, const u8 *src) { memcpy(dst, src, 6); } static inline bool ether_addr_equal(const u8 *pa, const u8 *pb) { return (memcmp(pa, pb, 6) == 0); } static inline bool ether_addr_equal_64bits(const u8 *pa, const u8 *pb) { return (memcmp(pa, pb, 6) == 0); } static inline void eth_broadcast_addr(u8 *pa) { memset(pa, 0xff, 6); } static inline void random_ether_addr(u8 * dst) { - read_random(dst, 6); + if (read_random(dst, 6) == 0) + arc4rand(dst, 6, 0); dst[0] &= 0xfe; dst[0] |= 0x02; } #endif /* _LINUX_ETHERDEVICE */ Index: stable/10/sys/ofed/include/linux/random.h =================================================================== --- stable/10/sys/ofed/include/linux/random.h (revision 302270) +++ stable/10/sys/ofed/include/linux/random.h (revision 302271) @@ -1,41 +1,43 @@ /*- * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice unmodified, this list of conditions, and the following * disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _LINUX_RANDOM_H_ #define _LINUX_RANDOM_H_ #include +#include static inline void get_random_bytes(void *buf, int nbytes) { - read_random(buf, nbytes); + if (read_random(buf, nbytes) == 0) + arc4rand(buf, nbytes, 0); } #endif /* _LINUX_RANDOM_H_ */ Index: stable/10 =================================================================== --- stable/10 (revision 302270) +++ stable/10 (revision 302271) Property changes on: stable/10 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head:r301544