net: ipv4: only use when knox_ncm is enabled
authorMichael Benedict <michaelbt@live.com>
Wed, 6 Jun 2018 15:54:25 +0000 (01:54 +1000)
committerMichael Benedict <michaelbt@live.com>
Sun, 25 Aug 2019 07:46:23 +0000 (17:46 +1000)
Signed-off-by: Michael Benedict <michaelbt@live.com>
net/ipv4/af_inet.c

index 26cab1c3b6ff283c6c1130f437f4a57148a31532..ced5199416f9ee156ff6dbdaf8ca080a144e2d29 100644 (file)
@@ -422,6 +422,7 @@ out_rcu_unlock:
        goto out;
 }
 
+#ifdef CONFIG_KNOX_NCM
 /* START_OF_KNOX_NPA */
 /** The function is used to check if the ncm feature is enabled or not; if enabled then it calls knox_collect_socket_data function in ncm.c to record all the socket data; **/
 static void knox_collect_metadata(struct socket *sock) {
@@ -430,6 +431,7 @@ static void knox_collect_metadata(struct socket *sock) {
     }
 }
 /* END_OF_KNOX_NPA */
+#endif
 
 /*
  *     The peer socket should always be NULL (or else). When we call this
@@ -460,9 +462,11 @@ int inet_release(struct socket *sock)
                if (sock_flag(sk, SOCK_LINGER) &&
                    !(current->flags & PF_EXITING))
                        timeout = sk->sk_lingertime;
+#ifdef CONFIG_KNOX_NCM
         /* START_OF_KNOX_NPA */
         knox_collect_metadata(sock);
         /* END_OF_KNOX_NPA */
+#endif
                sock->sk = NULL;
                sk->sk_prot->close(sk, timeout);
        }