Skip to content

Instantly share code, notes, and snippets.

@kkumar-fk
Last active July 23, 2019 04:25
Show Gist options
  • Save kkumar-fk/f58ad8c7d6c66db1ae01f5daadfad54a to your computer and use it in GitHub Desktop.
Save kkumar-fk/f58ad8c7d6c66db1ae01f5daadfad54a to your computer and use it in GitHub Desktop.
code blob
struct sock *__inet_lookup(tcp_hashinfo, skb, src_addr, src_port, dst_addr, dst_port)
{
/* Convert dest_port# from network to host byte order */
u16 hnum = ntohs(dst_port);
/* First look for an established socket ... */
sk = __inet_lookup_established(tcp_hashinfo, src_addr, src_port, dst_addr, hnum);
if (sk)
return sk;
/* failing which, look for a LISTEN socket */
return __inet_lookup_listener(tcp_hashinfo, skb, src_addr, src_port, dst_addr, hnum);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment