tcp_ipv4.c (ac0c955d5048c2c580fa7166a89133f0fd76c125) | tcp_ipv4.c (f8ab18d2d987a59ccbf0495032b2aef05b730037) |
---|---|
1/* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * Implementation of the Transmission Control Protocol(TCP). 7 * 8 * Version: $Id: tcp_ipv4.c,v 1.240 2002/02/01 22:01:04 davem Exp $ --- 819 unchanged lines hidden (view full) --- 828{ 829 struct tcp_sock *tp = tcp_sk(sk); 830 int i; 831 832 if (!tp->md5sig_info || !tp->md5sig_info->entries4) 833 return NULL; 834 for (i = 0; i < tp->md5sig_info->entries4; i++) { 835 if (tp->md5sig_info->keys4[i].addr == addr) | 1/* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * Implementation of the Transmission Control Protocol(TCP). 7 * 8 * Version: $Id: tcp_ipv4.c,v 1.240 2002/02/01 22:01:04 davem Exp $ --- 819 unchanged lines hidden (view full) --- 828{ 829 struct tcp_sock *tp = tcp_sk(sk); 830 int i; 831 832 if (!tp->md5sig_info || !tp->md5sig_info->entries4) 833 return NULL; 834 for (i = 0; i < tp->md5sig_info->entries4; i++) { 835 if (tp->md5sig_info->keys4[i].addr == addr) |
836 return (struct tcp_md5sig_key *) 837 &tp->md5sig_info->keys4[i]; | 836 return &tp->md5sig_info->keys4[i].base; |
838 } 839 return NULL; 840} 841 842struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk, 843 struct sock *addr_sk) 844{ 845 return tcp_v4_md5_do_lookup(sk, inet_sk(addr_sk)->daddr); --- 14 unchanged lines hidden (view full) --- 860 /* Add Key to the list */ 861 struct tcp4_md5sig_key *key; 862 struct tcp_sock *tp = tcp_sk(sk); 863 struct tcp4_md5sig_key *keys; 864 865 key = (struct tcp4_md5sig_key *)tcp_v4_md5_do_lookup(sk, addr); 866 if (key) { 867 /* Pre-existing entry - just update that one. */ | 837 } 838 return NULL; 839} 840 841struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk, 842 struct sock *addr_sk) 843{ 844 return tcp_v4_md5_do_lookup(sk, inet_sk(addr_sk)->daddr); --- 14 unchanged lines hidden (view full) --- 859 /* Add Key to the list */ 860 struct tcp4_md5sig_key *key; 861 struct tcp_sock *tp = tcp_sk(sk); 862 struct tcp4_md5sig_key *keys; 863 864 key = (struct tcp4_md5sig_key *)tcp_v4_md5_do_lookup(sk, addr); 865 if (key) { 866 /* Pre-existing entry - just update that one. */ |
868 kfree(key->key); 869 key->key = newkey; 870 key->keylen = newkeylen; | 867 kfree(key->base.key); 868 key->base.key = newkey; 869 key->base.keylen = newkeylen; |
871 } else { 872 struct tcp_md5sig_info *md5sig; 873 874 if (!tp->md5sig_info) { 875 tp->md5sig_info = kzalloc(sizeof(*tp->md5sig_info), 876 GFP_ATOMIC); 877 if (!tp->md5sig_info) { 878 kfree(newkey); --- 22 unchanged lines hidden (view full) --- 901 902 /* Free old key list, and reference new one */ 903 if (md5sig->keys4) 904 kfree(md5sig->keys4); 905 md5sig->keys4 = keys; 906 md5sig->alloced4++; 907 } 908 md5sig->entries4++; | 870 } else { 871 struct tcp_md5sig_info *md5sig; 872 873 if (!tp->md5sig_info) { 874 tp->md5sig_info = kzalloc(sizeof(*tp->md5sig_info), 875 GFP_ATOMIC); 876 if (!tp->md5sig_info) { 877 kfree(newkey); --- 22 unchanged lines hidden (view full) --- 900 901 /* Free old key list, and reference new one */ 902 if (md5sig->keys4) 903 kfree(md5sig->keys4); 904 md5sig->keys4 = keys; 905 md5sig->alloced4++; 906 } 907 md5sig->entries4++; |
909 md5sig->keys4[md5sig->entries4 - 1].addr = addr; 910 md5sig->keys4[md5sig->entries4 - 1].key = newkey; 911 md5sig->keys4[md5sig->entries4 - 1].keylen = newkeylen; | 908 md5sig->keys4[md5sig->entries4 - 1].addr = addr; 909 md5sig->keys4[md5sig->entries4 - 1].base.key = newkey; 910 md5sig->keys4[md5sig->entries4 - 1].base.keylen = newkeylen; |
912 } 913 return 0; 914} 915 916EXPORT_SYMBOL(tcp_v4_md5_do_add); 917 918static int tcp_v4_md5_add_func(struct sock *sk, struct sock *addr_sk, 919 u8 *newkey, u8 newkeylen) --- 5 unchanged lines hidden (view full) --- 925int tcp_v4_md5_do_del(struct sock *sk, __be32 addr) 926{ 927 struct tcp_sock *tp = tcp_sk(sk); 928 int i; 929 930 for (i = 0; i < tp->md5sig_info->entries4; i++) { 931 if (tp->md5sig_info->keys4[i].addr == addr) { 932 /* Free the key */ | 911 } 912 return 0; 913} 914 915EXPORT_SYMBOL(tcp_v4_md5_do_add); 916 917static int tcp_v4_md5_add_func(struct sock *sk, struct sock *addr_sk, 918 u8 *newkey, u8 newkeylen) --- 5 unchanged lines hidden (view full) --- 924int tcp_v4_md5_do_del(struct sock *sk, __be32 addr) 925{ 926 struct tcp_sock *tp = tcp_sk(sk); 927 int i; 928 929 for (i = 0; i < tp->md5sig_info->entries4; i++) { 930 if (tp->md5sig_info->keys4[i].addr == addr) { 931 /* Free the key */ |
933 kfree(tp->md5sig_info->keys4[i].key); | 932 kfree(tp->md5sig_info->keys4[i].base.key); |
934 tp->md5sig_info->entries4--; 935 936 if (tp->md5sig_info->entries4 == 0) { 937 kfree(tp->md5sig_info->keys4); 938 tp->md5sig_info->keys4 = NULL; 939 tp->md5sig_info->alloced4 = 0; 940 } else if (tp->md5sig_info->entries4 != i) { 941 /* Need to do some manipulation */ --- 17 unchanged lines hidden (view full) --- 959 960 /* Free each key, then the set of key keys, 961 * the crypto element, and then decrement our 962 * hold on the last resort crypto. 963 */ 964 if (tp->md5sig_info->entries4) { 965 int i; 966 for (i = 0; i < tp->md5sig_info->entries4; i++) | 933 tp->md5sig_info->entries4--; 934 935 if (tp->md5sig_info->entries4 == 0) { 936 kfree(tp->md5sig_info->keys4); 937 tp->md5sig_info->keys4 = NULL; 938 tp->md5sig_info->alloced4 = 0; 939 } else if (tp->md5sig_info->entries4 != i) { 940 /* Need to do some manipulation */ --- 17 unchanged lines hidden (view full) --- 958 959 /* Free each key, then the set of key keys, 960 * the crypto element, and then decrement our 961 * hold on the last resort crypto. 962 */ 963 if (tp->md5sig_info->entries4) { 964 int i; 965 for (i = 0; i < tp->md5sig_info->entries4; i++) |
967 kfree(tp->md5sig_info->keys4[i].key); | 966 kfree(tp->md5sig_info->keys4[i].base.key); |
968 tp->md5sig_info->entries4 = 0; 969 tcp_free_md5sig_pool(); 970 } 971 if (tp->md5sig_info->keys4) { 972 kfree(tp->md5sig_info->keys4); 973 tp->md5sig_info->keys4 = NULL; 974 tp->md5sig_info->alloced4 = 0; 975 } --- 1500 unchanged lines hidden --- | 967 tp->md5sig_info->entries4 = 0; 968 tcp_free_md5sig_pool(); 969 } 970 if (tp->md5sig_info->keys4) { 971 kfree(tp->md5sig_info->keys4); 972 tp->md5sig_info->keys4 = NULL; 973 tp->md5sig_info->alloced4 = 0; 974 } --- 1500 unchanged lines hidden --- |