diff options
-rw-r--r-- | net/ipv4/Kconfig | 4 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 41 |
2 files changed, 1 insertions, 44 deletions
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig index 39e0cb763588..503e7059e312 100644 --- a/net/ipv4/Kconfig +++ b/net/ipv4/Kconfig | |||
@@ -630,9 +630,5 @@ config TCP_MD5SIG | |||
630 | 630 | ||
631 | If unsure, say N. | 631 | If unsure, say N. |
632 | 632 | ||
633 | config TCP_MD5SIG_DEBUG | ||
634 | bool "TCP: MD5 Signature Option debugging" | ||
635 | depends on TCP_MD5SIG | ||
636 | |||
637 | source "net/ipv4/ipvs/Kconfig" | 633 | source "net/ipv4/ipvs/Kconfig" |
638 | 634 | ||
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 4913f25e5ad5..dd3509a59fe0 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -1017,9 +1017,6 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, | |||
1017 | struct scatterlist sg[4]; | 1017 | struct scatterlist sg[4]; |
1018 | __u16 data_len; | 1018 | __u16 data_len; |
1019 | int block = 0; | 1019 | int block = 0; |
1020 | #ifdef CONFIG_TCP_MD5SIG_DEBUG | ||
1021 | int i; | ||
1022 | #endif | ||
1023 | __sum16 old_checksum; | 1020 | __sum16 old_checksum; |
1024 | struct tcp_md5sig_pool *hp; | 1021 | struct tcp_md5sig_pool *hp; |
1025 | struct tcp4_pseudohdr *bp; | 1022 | struct tcp4_pseudohdr *bp; |
@@ -1052,13 +1049,6 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, | |||
1052 | sg_set_buf(&sg[block++], bp, sizeof(*bp)); | 1049 | sg_set_buf(&sg[block++], bp, sizeof(*bp)); |
1053 | nbytes += sizeof(*bp); | 1050 | nbytes += sizeof(*bp); |
1054 | 1051 | ||
1055 | #ifdef CONFIG_TCP_MD5SIG_DEBUG | ||
1056 | printk("Calcuating hash for: "); | ||
1057 | for (i = 0; i < sizeof(*bp); i++) | ||
1058 | printk("%02x ", (unsigned int)((unsigned char *)bp)[i]); | ||
1059 | printk(" "); | ||
1060 | #endif | ||
1061 | |||
1062 | /* 2. the TCP header, excluding options, and assuming a | 1052 | /* 2. the TCP header, excluding options, and assuming a |
1063 | * checksum of zero/ | 1053 | * checksum of zero/ |
1064 | */ | 1054 | */ |
@@ -1066,10 +1056,7 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, | |||
1066 | th->check = 0; | 1056 | th->check = 0; |
1067 | sg_set_buf(&sg[block++], th, sizeof(struct tcphdr)); | 1057 | sg_set_buf(&sg[block++], th, sizeof(struct tcphdr)); |
1068 | nbytes += sizeof(struct tcphdr); | 1058 | nbytes += sizeof(struct tcphdr); |
1069 | #ifdef CONFIG_TCP_MD5SIG_DEBUG | 1059 | |
1070 | for (i = 0; i < sizeof(struct tcphdr); i++) | ||
1071 | printk(" %02x", (unsigned int)((unsigned char *)th)[i]); | ||
1072 | #endif | ||
1073 | /* 3. the TCP segment data (if any) */ | 1060 | /* 3. the TCP segment data (if any) */ |
1074 | data_len = tcplen - (th->doff << 2); | 1061 | data_len = tcplen - (th->doff << 2); |
1075 | if (data_len > 0) { | 1062 | if (data_len > 0) { |
@@ -1084,12 +1071,6 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, | |||
1084 | sg_set_buf(&sg[block++], key->key, key->keylen); | 1071 | sg_set_buf(&sg[block++], key->key, key->keylen); |
1085 | nbytes += key->keylen; | 1072 | nbytes += key->keylen; |
1086 | 1073 | ||
1087 | #ifdef CONFIG_TCP_MD5SIG_DEBUG | ||
1088 | printk(" and password: "); | ||
1089 | for (i = 0; i < key->keylen; i++) | ||
1090 | printk("%02x ", (unsigned int)key->key[i]); | ||
1091 | #endif | ||
1092 | |||
1093 | /* Now store the Hash into the packet */ | 1074 | /* Now store the Hash into the packet */ |
1094 | err = crypto_hash_init(desc); | 1075 | err = crypto_hash_init(desc); |
1095 | if (err) | 1076 | if (err) |
@@ -1106,12 +1087,6 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, | |||
1106 | th->check = old_checksum; | 1087 | th->check = old_checksum; |
1107 | 1088 | ||
1108 | out: | 1089 | out: |
1109 | #ifdef CONFIG_TCP_MD5SIG_DEBUG | ||
1110 | printk(" result:"); | ||
1111 | for (i = 0; i < 16; i++) | ||
1112 | printk(" %02x", (unsigned int)(((u8*)md5_hash)[i])); | ||
1113 | printk("\n"); | ||
1114 | #endif | ||
1115 | return 0; | 1090 | return 0; |
1116 | clear_hash: | 1091 | clear_hash: |
1117 | tcp_put_md5sig_pool(); | 1092 | tcp_put_md5sig_pool(); |
@@ -1241,20 +1216,6 @@ done_opts: | |||
1241 | NIPQUAD(iph->saddr), ntohs(th->source), | 1216 | NIPQUAD(iph->saddr), ntohs(th->source), |
1242 | NIPQUAD(iph->daddr), ntohs(th->dest), | 1217 | NIPQUAD(iph->daddr), ntohs(th->dest), |
1243 | genhash ? " tcp_v4_calc_md5_hash failed" : ""); | 1218 | genhash ? " tcp_v4_calc_md5_hash failed" : ""); |
1244 | #ifdef CONFIG_TCP_MD5SIG_DEBUG | ||
1245 | do { | ||
1246 | int i; | ||
1247 | printk("Received: "); | ||
1248 | for (i = 0; i < 16; i++) | ||
1249 | printk("%02x ", | ||
1250 | 0xff & (int)hash_location[i]); | ||
1251 | printk("\n"); | ||
1252 | printk("Calculated: "); | ||
1253 | for (i = 0; i < 16; i++) | ||
1254 | printk("%02x ", 0xff & (int)newhash[i]); | ||
1255 | printk("\n"); | ||
1256 | } while(0); | ||
1257 | #endif | ||
1258 | } | 1219 | } |
1259 | return 1; | 1220 | return 1; |
1260 | } | 1221 | } |