While reading how to find a tcp listener in linux kervel, version 5.3.6
I found that only dest port was converted to host short to do hash
why don't convert saddr, sport, daddr to host long or host short either ?
code as follows, in linux-5.3.6/include/net/inet_hashtables.h:
static inline struct sock *inet_lookup_listener(struct net *net,
struct inet_hashinfo *hashinfo,
struct sk_buff *skb, int doff,
__be32 saddr, __be16 sport,
__be32 daddr, __be16 dport, int dif, int sdif)
{
return __inet_lookup_listener(net, hashinfo, skb, doff, saddr, sport,
daddr, ntohs(dport), dif, sdif);
}
any help will be appreciated
I found that only dest port was converted to host short to do hash
why don't convert saddr, sport, daddr to host long or host short either ?
code as follows, in linux-5.3.6/include/net/inet_hashtables.h:
static inline struct sock *inet_lookup_listener(struct net *net,
struct inet_hashinfo *hashinfo,
struct sk_buff *skb, int doff,
__be32 saddr, __be16 sport,
__be32 daddr, __be16 dport, int dif, int sdif)
{
return __inet_lookup_listener(net, hashinfo, skb, doff, saddr, sport,
daddr, ntohs(dport), dif, sdif);
}
any help will be appreciated