@@ -70,7 +70,8 @@ static struct sctp_association *__sctp_rcv_lookup(struct sk_buff *skb,
7070 const union sctp_addr * laddr ,
7171 const union sctp_addr * paddr ,
7272 struct sctp_transport * * transportp );
73- static struct sctp_endpoint * __sctp_rcv_lookup_endpoint (const union sctp_addr * laddr );
73+ static struct sctp_endpoint * __sctp_rcv_lookup_endpoint (struct net * net ,
74+ const union sctp_addr * laddr );
7475static struct sctp_association * __sctp_lookup_association (
7576 const union sctp_addr * local ,
7677 const union sctp_addr * peer ,
@@ -129,6 +130,7 @@ int sctp_rcv(struct sk_buff *skb)
129130 union sctp_addr dest ;
130131 int family ;
131132 struct sctp_af * af ;
133+ struct net * net = dev_net (skb -> dev );
132134
133135 if (skb -> pkt_type != PACKET_HOST )
134136 goto discard_it ;
@@ -181,7 +183,7 @@ int sctp_rcv(struct sk_buff *skb)
181183 asoc = __sctp_rcv_lookup (skb , & src , & dest , & transport );
182184
183185 if (!asoc )
184- ep = __sctp_rcv_lookup_endpoint (& dest );
186+ ep = __sctp_rcv_lookup_endpoint (net , & dest );
185187
186188 /* Retrieve the common input handling substructure. */
187189 rcvr = asoc ? & asoc -> base : & ep -> base ;
@@ -723,12 +725,13 @@ static int sctp_rcv_ootb(struct sk_buff *skb)
723725/* Insert endpoint into the hash table. */
724726static void __sctp_hash_endpoint (struct sctp_endpoint * ep )
725727{
728+ struct net * net = sock_net (ep -> base .sk );
726729 struct sctp_ep_common * epb ;
727730 struct sctp_hashbucket * head ;
728731
729732 epb = & ep -> base ;
730733
731- epb -> hashent = sctp_ep_hashfn (epb -> bind_addr .port );
734+ epb -> hashent = sctp_ep_hashfn (net , epb -> bind_addr .port );
732735 head = & sctp_ep_hashtable [epb -> hashent ];
733736
734737 sctp_write_lock (& head -> lock );
@@ -747,12 +750,13 @@ void sctp_hash_endpoint(struct sctp_endpoint *ep)
747750/* Remove endpoint from the hash table. */
748751static void __sctp_unhash_endpoint (struct sctp_endpoint * ep )
749752{
753+ struct net * net = sock_net (ep -> base .sk );
750754 struct sctp_hashbucket * head ;
751755 struct sctp_ep_common * epb ;
752756
753757 epb = & ep -> base ;
754758
755- epb -> hashent = sctp_ep_hashfn (epb -> bind_addr .port );
759+ epb -> hashent = sctp_ep_hashfn (net , epb -> bind_addr .port );
756760
757761 head = & sctp_ep_hashtable [epb -> hashent ];
758762
@@ -770,20 +774,21 @@ void sctp_unhash_endpoint(struct sctp_endpoint *ep)
770774}
771775
772776/* Look up an endpoint. */
773- static struct sctp_endpoint * __sctp_rcv_lookup_endpoint (const union sctp_addr * laddr )
777+ static struct sctp_endpoint * __sctp_rcv_lookup_endpoint (struct net * net ,
778+ const union sctp_addr * laddr )
774779{
775780 struct sctp_hashbucket * head ;
776781 struct sctp_ep_common * epb ;
777782 struct sctp_endpoint * ep ;
778783 struct hlist_node * node ;
779784 int hash ;
780785
781- hash = sctp_ep_hashfn (ntohs (laddr -> v4 .sin_port ));
786+ hash = sctp_ep_hashfn (net , ntohs (laddr -> v4 .sin_port ));
782787 head = & sctp_ep_hashtable [hash ];
783788 read_lock (& head -> lock );
784789 sctp_for_each_hentry (epb , node , & head -> chain ) {
785790 ep = sctp_ep (epb );
786- if (sctp_endpoint_is_match (ep , laddr ))
791+ if (sctp_endpoint_is_match (ep , net , laddr ))
787792 goto hit ;
788793 }
789794
0 commit comments