[PATCH V2] dumping the unknown address when got a connect from non cluster node

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> Another patch useful for debugging cluster.conf and network configuration.
>> 
>> This is useful when you build a cluster with nodes connected each others with
>> a software bridge(virbrN). If you install wrong iptabels configuration, dlm
>> cannot establish connections. You will just see 
>> 
>>        dlm: connect from non cluster node
>> 
>> in demsg. It is difficult to understand what happens quickly.
>> This patch dumps the address of the non cluster node.
>> 
>> 
>> Signed-off-by: Masatake YAMATO <yamato@xxxxxxxxxx>
>> 
>> diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
>> index bffa1e7..90c1c2e 100644
>> --- a/fs/dlm/lowcomms.c
>> +++ b/fs/dlm/lowcomms.c
>> @@ -748,7 +748,12 @@ static int tcp_accept_from_sock(struct connection *con)
>>  	/* Get the new node's NODEID */
>>  	make_sockaddr(&peeraddr, 0, &len);
>>  	if (dlm_addr_to_nodeid(&peeraddr, &nodeid)) {
>> +		int i;
>> +		unsigned char *b=(unsigned char *)&peeraddr;
>>  		log_print("connect from non cluster node");
>> +		for (i=0; i<sizeof(struct sockaddr_storage);i++)
>> +			printk("%02x ", b[i]);
>> +		printk("\n");
>>  		sock_release(newsock);
>>  		mutex_unlock(&con->sock_mutex);
>>  		return -1;
> 
> Could you use print_hex_dump_bytes instead?
> Dave

Here is the revised version.


This patch is useful when you build a cluster with nodes connected
each others with a software bridge(virbrN). If you install wrong
iptabels configuration, dlm cannot establish connections. You will
just see

       dlm: connect from non cluster node

in demsg. It is difficult to understand what happens quickly.  This
patch dumps the address of the non cluster node with print_hex_dump_bytes
function:


       dlm: connect from non cluster node
       ss: 02 00 00 00 c0 a8 97 01 00 00 00 00 00 00 00 00  ................
       ....


Using print_hex_dump_bytes is sugested by David Teigland.


Signed-off-by: Masatake YAMATO <yamato@xxxxxxxxxx>

diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index bffa1e7..a762e9f 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -512,12 +512,10 @@ static void process_sctp_notification(struct connection *con,
 			}
 			make_sockaddr(&prim.ssp_addr, 0, &addr_len);
 			if (dlm_addr_to_nodeid(&prim.ssp_addr, &nodeid)) {
-				int i;
 				unsigned char *b=(unsigned char *)&prim.ssp_addr;
 				log_print("reject connect from unknown addr");
-				for (i=0; i<sizeof(struct sockaddr_storage);i++)
-					printk("%02x ", b[i]);
-				printk("\n");
+				print_hex_dump_bytes("ss: ", DUMP_PREFIX_NONE, 
+						     b, sizeof(struct sockaddr_storage));
 				sctp_send_shutdown(prim.ssp_assoc_id);
 				return;
 			}
@@ -748,7 +746,10 @@ static int tcp_accept_from_sock(struct connection *con)
 	/* Get the new node's NODEID */
 	make_sockaddr(&peeraddr, 0, &len);
 	if (dlm_addr_to_nodeid(&peeraddr, &nodeid)) {
+		unsigned char *b=(unsigned char *)&peeraddr;
 		log_print("connect from non cluster node");
+		print_hex_dump_bytes("ss: ", DUMP_PREFIX_NONE, 
+				     b, sizeof(struct sockaddr_storage));
 		sock_release(newsock);
 		mutex_unlock(&con->sock_mutex);
 		return -1;

--
Linux-cluster mailing list
Linux-cluster@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/linux-cluster


[Index of Archives]     [Corosync Cluster Engine]     [GFS]     [Linux Virtualization]     [Centos Virtualization]     [Centos]     [Linux RAID]     [Fedora Users]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite Camping]

  Powered by Linux