lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1550242187-29660-3-git-send-email-laoar.shao@gmail.com>
Date:   Fri, 15 Feb 2019 22:49:44 +0800
From:   Yafang Shao <laoar.shao@...il.com>
To:     davem@...emloft.net
Cc:     daniel@...earbox.net, edumazet@...gle.com, netdev@...r.kernel.org,
        shaoyafang@...iglobal.com, Yafang Shao <laoar.shao@...il.com>
Subject: [net-next 2/5] x25: clean up SOCK_DEBUG()

Per discussion with Daniel[1] and Eric[2], the SOCK_DEBUG() is a very
ancient interface, which is not very useful for debugging.
So we'd better clean up it.

This patch cleans up it for x25.

[1] https://patchwork.ozlabs.org/patch/1035573/
[2] https://patchwork.ozlabs.org/patch/1040533/

Signed-off-by: Yafang Shao <laoar.shao@...il.com>
---
 net/x25/af_x25.c         | 12 ------------
 net/x25/x25_facilities.c | 32 ++++++++++----------------------
 net/x25/x25_out.c        |  4 +---
 3 files changed, 11 insertions(+), 37 deletions(-)

diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index 5121729..5892d05 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -705,7 +705,6 @@ static int x25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
 	x25_insert_socket(sk);
 	sock_reset_flag(sk, SOCK_ZAPPED);
 	release_sock(sk);
-	SOCK_DEBUG(sk, "x25_bind: socket is bound\n");
 out:
 	return rc;
 }
@@ -1148,11 +1147,7 @@ static int x25_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
 		goto out;
 	}
 
-	SOCK_DEBUG(sk, "x25_sendmsg: sendto: Addresses built.\n");
-
 	/* Build a packet */
-	SOCK_DEBUG(sk, "x25_sendmsg: sendto: building packet.\n");
-
 	if ((msg->msg_flags & MSG_OOB) && len > 32)
 		len = 32;
 
@@ -1170,8 +1165,6 @@ static int x25_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
 	/*
 	 *	Put the data on the end
 	 */
-	SOCK_DEBUG(sk, "x25_sendmsg: Copying user data\n");
-
 	skb_reset_transport_header(skb);
 	skb_put(skb, len);
 
@@ -1194,8 +1187,6 @@ static int x25_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
 	/*
 	 *	Push down the X.25 header
 	 */
-	SOCK_DEBUG(sk, "x25_sendmsg: Building X.25 Header.\n");
-
 	if (msg->msg_flags & MSG_OOB) {
 		if (x25->neighbour->extended) {
 			asmptr    = skb_push(skb, X25_STD_MIN_LEN);
@@ -1228,9 +1219,6 @@ static int x25_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
 			skb->data[0] |= X25_Q_BIT;
 	}
 
-	SOCK_DEBUG(sk, "x25_sendmsg: Built header.\n");
-	SOCK_DEBUG(sk, "x25_sendmsg: Transmitting buffer\n");
-
 	rc = -ENOTCONN;
 	if (sk->sk_state != TCP_ESTABLISHED)
 		goto out_kfree_skb;
diff --git a/net/x25/x25_facilities.c b/net/x25/x25_facilities.c
index ad1734d..74a5284 100644
--- a/net/x25/x25_facilities.c
+++ b/net/x25/x25_facilities.c
@@ -286,10 +286,8 @@ int x25_negotiate_facilities(struct sk_buff *skb, struct sock *sk,
 	/*
 	 *	They want reverse charging, we won't accept it.
 	 */
-	if ((theirs.reverse & 0x01 ) && (ours->reverse & 0x01)) {
-		SOCK_DEBUG(sk, "X.25: rejecting reverse charging request\n");
+	if ((theirs.reverse & 0x01) && (ours->reverse & 0x01))
 		return -1;
-	}
 
 	new->reverse = theirs.reverse;
 
@@ -298,37 +296,27 @@ int x25_negotiate_facilities(struct sk_buff *skb, struct sock *sk,
 		int theirs_out = theirs.throughput & 0xf0;
 		int ours_in  = ours->throughput & 0x0f;
 		int ours_out = ours->throughput & 0xf0;
-		if (!ours_in || theirs_in < ours_in) {
-			SOCK_DEBUG(sk, "X.25: inbound throughput negotiated\n");
+		if (!ours_in || theirs_in < ours_in)
 			new->throughput = (new->throughput & 0xf0) | theirs_in;
-		}
-		if (!ours_out || theirs_out < ours_out) {
-			SOCK_DEBUG(sk,
-				"X.25: outbound throughput negotiated\n");
+
+		if (!ours_out || theirs_out < ours_out)
 			new->throughput = (new->throughput & 0x0f) | theirs_out;
-		}
 	}
 
 	if (theirs.pacsize_in && theirs.pacsize_out) {
-		if (theirs.pacsize_in < ours->pacsize_in) {
-			SOCK_DEBUG(sk, "X.25: packet size inwards negotiated down\n");
+		if (theirs.pacsize_in < ours->pacsize_in)
 			new->pacsize_in = theirs.pacsize_in;
-		}
-		if (theirs.pacsize_out < ours->pacsize_out) {
-			SOCK_DEBUG(sk, "X.25: packet size outwards negotiated down\n");
+
+		if (theirs.pacsize_out < ours->pacsize_out)
 			new->pacsize_out = theirs.pacsize_out;
-		}
 	}
 
 	if (theirs.winsize_in && theirs.winsize_out) {
-		if (theirs.winsize_in < ours->winsize_in) {
-			SOCK_DEBUG(sk, "X.25: window size inwards negotiated down\n");
+		if (theirs.winsize_in < ours->winsize_in)
 			new->winsize_in = theirs.winsize_in;
-		}
-		if (theirs.winsize_out < ours->winsize_out) {
-			SOCK_DEBUG(sk, "X.25: window size outwards negotiated down\n");
+
+		if (theirs.winsize_out < ours->winsize_out)
 			new->winsize_out = theirs.winsize_out;
-		}
 	}
 
 	return len;
diff --git a/net/x25/x25_out.c b/net/x25/x25_out.c
index 0144271..2a74f26 100644
--- a/net/x25/x25_out.c
+++ b/net/x25/x25_out.c
@@ -77,9 +77,7 @@ int x25_output(struct sock *sk, struct sk_buff *skb)
 					kfree_skb(skb);
 					return sent;
 				}
-				SOCK_DEBUG(sk, "x25_output: fragment alloc"
-					       " failed, err=%d, %d bytes "
-					       "sent\n", err, sent);
+
 				return err;
 			}
 
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ