forked from openvswitch/ovs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some of code is backported from following commit. commit 13dd4a9 Author: Joe Stringer <[email protected]> Date: Tue Mar 24 16:16:18 2015 -0700 compat: Fix RHEL7 build. Tested against 3.10.0-229.el7.x86_64. ----------8<-------- Reported-by: Alex Wang <[email protected]> Signed-off-by: Pravin B Shelar <[email protected]> Acked-by: Flavio Leitner <[email protected]>
- Loading branch information
Pravin B Shelar
committed
Jun 11, 2015
1 parent
1cb39f3
commit 943fdfe
Showing
9 changed files
with
109 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#ifndef __NET_UDP_WRAPPER_H | ||
#define __NET_UDP_WRAPPER_H 1 | ||
|
||
#include <linux/version.h> | ||
|
||
#ifdef inet_get_local_port_range | ||
/* RHEL7 backports udp_flow_src_port() using an older version of | ||
* inet_get_local_port_range(). */ | ||
#undef inet_get_local_port_range | ||
#include_next <net/udp.h> | ||
#define inet_get_local_port_range rpl_inet_get_local_port_range | ||
#else | ||
#include_next <net/udp.h> | ||
#endif | ||
|
||
#ifndef HAVE_UDP_FLOW_SRC_PORT | ||
static inline __be16 rpl_udp_flow_src_port(struct net *net, struct sk_buff *skb, | ||
int min, int max, bool use_eth) | ||
{ | ||
u32 hash; | ||
|
||
if (min >= max) { | ||
/* Use default range */ | ||
inet_get_local_port_range(net, &min, &max); | ||
} | ||
|
||
hash = skb_get_hash(skb); | ||
if (unlikely(!hash) && use_eth) { | ||
/* Can't find a normal hash, caller has indicated an Ethernet | ||
* packet so use that to compute a hash. | ||
*/ | ||
hash = jhash(skb->data, 2 * ETH_ALEN, | ||
(__force u32) skb->protocol); | ||
} | ||
|
||
/* Since this is being sent on the wire obfuscate hash a bit | ||
* to minimize possbility that any useful information to an | ||
* attacker is leaked. Only upper 16 bits are relevant in the | ||
* computation for 16 bit port value. | ||
*/ | ||
hash ^= hash << 16; | ||
|
||
return htons((((u64) hash * (max - min)) >> 32) + min); | ||
} | ||
|
||
#define udp_flow_src_port rpl_udp_flow_src_port | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters