goto discard;
}
-extern struct proto_ops inet_stream_ops;
-
-extern int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len);
-
/*
* From tcp_input.c
*/
goto no_tcp_socket;
process:
- /* Silently drop if VNET is active (if INET bind() has been
- * overridden) and the context is not entitled to read the
- * packet.
+#if defined(CONFIG_VNET) || defined(CONFIG_VNET_MODULE)
+ /* Silently drop if VNET is active and the context is not
+ * entitled to read the packet.
*/
- if (inet_stream_ops.bind != inet_bind &&
+ if (vnet_active &&
(int) sk->sk_xid > 0 && sk->sk_xid != skb->xid)
goto discard_it;
+#endif
if (sk->sk_state == TCP_TIME_WAIT)
goto do_time_wait;
if (skb->len < (th->doff << 2) || tcp_checksum_complete(skb)) {
bad_packet:
TCP_INC_STATS_BH(TCP_MIB_INERRS);
- } else if (!skb->sk) {
+#if defined(CONFIG_VNET) || defined(CONFIG_VNET_MODULE)
+ } else if (vnet_active && skb->sk) {
/* VNET: Suppress RST if the port was bound to a (presumably raw) socket */
+#endif
+ } else {
tcp_v4_send_reset(skb);
}
if (udp_checksum_complete(skb))
goto csum_error;
- /* VNET: Suppress ICMP Unreachable if the port was bound to a (presumably raw) socket */
- if (!skb->sk) {
- UDP_INC_STATS_BH(UDP_MIB_NOPORTS);
- icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);
+#if defined(CONFIG_VNET) || defined(CONFIG_VNET_MODULE)
+ if (vnet_active && skb->sk) {
+ /* VNET: Suppress ICMP Unreachable if the port was bound to a (presumably raw) socket */
+ kfree_skb(skb);
+ return 0;
}
+#endif
+
+ UDP_INC_STATS_BH(UDP_MIB_NOPORTS);
+ icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);
/*
* Hmm. We got an UDP packet to a port to which we