diff options
-rw-r--r-- | net/ipv4/netfilter/arp_tables.c | 23 | ||||
-rw-r--r-- | net/ipv4/netfilter/ip_tables.c | 25 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6_tables.c | 25 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_lblcr.c | 44 | ||||
-rw-r--r-- | net/netfilter/nfnetlink_log.c | 2 |
5 files changed, 66 insertions, 53 deletions
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index 57098dcda294..f07d77f65751 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c | |||
@@ -644,8 +644,10 @@ static int translate_table(struct xt_table_info *newinfo, void *entry0, | |||
644 | /* Walk through entries, checking offsets. */ | 644 | /* Walk through entries, checking offsets. */ |
645 | xt_entry_foreach(iter, entry0, newinfo->size) { | 645 | xt_entry_foreach(iter, entry0, newinfo->size) { |
646 | ret = check_entry_size_and_hooks(iter, newinfo, entry0, | 646 | ret = check_entry_size_and_hooks(iter, newinfo, entry0, |
647 | entry0 + repl->size, repl->hook_entry, repl->underflow, | 647 | entry0 + repl->size, |
648 | repl->valid_hooks); | 648 | repl->hook_entry, |
649 | repl->underflow, | ||
650 | repl->valid_hooks); | ||
649 | if (ret != 0) | 651 | if (ret != 0) |
650 | break; | 652 | break; |
651 | ++i; | 653 | ++i; |
@@ -730,7 +732,7 @@ static void get_counters(const struct xt_table_info *t, | |||
730 | i = 0; | 732 | i = 0; |
731 | xt_entry_foreach(iter, t->entries[curcpu], t->size) { | 733 | xt_entry_foreach(iter, t->entries[curcpu], t->size) { |
732 | SET_COUNTER(counters[i], iter->counters.bcnt, | 734 | SET_COUNTER(counters[i], iter->counters.bcnt, |
733 | iter->counters.pcnt); | 735 | iter->counters.pcnt); |
734 | ++i; | 736 | ++i; |
735 | } | 737 | } |
736 | 738 | ||
@@ -741,7 +743,7 @@ static void get_counters(const struct xt_table_info *t, | |||
741 | xt_info_wrlock(cpu); | 743 | xt_info_wrlock(cpu); |
742 | xt_entry_foreach(iter, t->entries[cpu], t->size) { | 744 | xt_entry_foreach(iter, t->entries[cpu], t->size) { |
743 | ADD_COUNTER(counters[i], iter->counters.bcnt, | 745 | ADD_COUNTER(counters[i], iter->counters.bcnt, |
744 | iter->counters.pcnt); | 746 | iter->counters.pcnt); |
745 | ++i; | 747 | ++i; |
746 | } | 748 | } |
747 | xt_info_wrunlock(cpu); | 749 | xt_info_wrunlock(cpu); |
@@ -1356,8 +1358,11 @@ static int translate_compat_table(const char *name, | |||
1356 | /* Walk through entries, checking offsets. */ | 1358 | /* Walk through entries, checking offsets. */ |
1357 | xt_entry_foreach(iter0, entry0, total_size) { | 1359 | xt_entry_foreach(iter0, entry0, total_size) { |
1358 | ret = check_compat_entry_size_and_hooks(iter0, info, &size, | 1360 | ret = check_compat_entry_size_and_hooks(iter0, info, &size, |
1359 | entry0, entry0 + total_size, hook_entries, underflows, | 1361 | entry0, |
1360 | name); | 1362 | entry0 + total_size, |
1363 | hook_entries, | ||
1364 | underflows, | ||
1365 | name); | ||
1361 | if (ret != 0) | 1366 | if (ret != 0) |
1362 | goto out_unlock; | 1367 | goto out_unlock; |
1363 | ++j; | 1368 | ++j; |
@@ -1401,8 +1406,8 @@ static int translate_compat_table(const char *name, | |||
1401 | pos = entry1; | 1406 | pos = entry1; |
1402 | size = total_size; | 1407 | size = total_size; |
1403 | xt_entry_foreach(iter0, entry0, total_size) { | 1408 | xt_entry_foreach(iter0, entry0, total_size) { |
1404 | ret = compat_copy_entry_from_user(iter0, &pos, | 1409 | ret = compat_copy_entry_from_user(iter0, &pos, &size, |
1405 | &size, name, newinfo, entry1); | 1410 | name, newinfo, entry1); |
1406 | if (ret != 0) | 1411 | if (ret != 0) |
1407 | break; | 1412 | break; |
1408 | } | 1413 | } |
@@ -1617,7 +1622,7 @@ static int compat_copy_entries_to_user(unsigned int total_size, | |||
1617 | size = total_size; | 1622 | size = total_size; |
1618 | xt_entry_foreach(iter, loc_cpu_entry, total_size) { | 1623 | xt_entry_foreach(iter, loc_cpu_entry, total_size) { |
1619 | ret = compat_copy_entry_to_user(iter, &pos, | 1624 | ret = compat_copy_entry_to_user(iter, &pos, |
1620 | &size, counters, i++); | 1625 | &size, counters, i++); |
1621 | if (ret != 0) | 1626 | if (ret != 0) |
1622 | break; | 1627 | break; |
1623 | } | 1628 | } |
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c index c92f4e541cf6..b29c66df8d1f 100644 --- a/net/ipv4/netfilter/ip_tables.c +++ b/net/ipv4/netfilter/ip_tables.c | |||
@@ -836,8 +836,10 @@ translate_table(struct net *net, struct xt_table_info *newinfo, void *entry0, | |||
836 | /* Walk through entries, checking offsets. */ | 836 | /* Walk through entries, checking offsets. */ |
837 | xt_entry_foreach(iter, entry0, newinfo->size) { | 837 | xt_entry_foreach(iter, entry0, newinfo->size) { |
838 | ret = check_entry_size_and_hooks(iter, newinfo, entry0, | 838 | ret = check_entry_size_and_hooks(iter, newinfo, entry0, |
839 | entry0 + repl->size, repl->hook_entry, repl->underflow, | 839 | entry0 + repl->size, |
840 | repl->valid_hooks); | 840 | repl->hook_entry, |
841 | repl->underflow, | ||
842 | repl->valid_hooks); | ||
841 | if (ret != 0) | 843 | if (ret != 0) |
842 | return ret; | 844 | return ret; |
843 | ++i; | 845 | ++i; |
@@ -918,7 +920,7 @@ get_counters(const struct xt_table_info *t, | |||
918 | i = 0; | 920 | i = 0; |
919 | xt_entry_foreach(iter, t->entries[curcpu], t->size) { | 921 | xt_entry_foreach(iter, t->entries[curcpu], t->size) { |
920 | SET_COUNTER(counters[i], iter->counters.bcnt, | 922 | SET_COUNTER(counters[i], iter->counters.bcnt, |
921 | iter->counters.pcnt); | 923 | iter->counters.pcnt); |
922 | ++i; | 924 | ++i; |
923 | } | 925 | } |
924 | 926 | ||
@@ -929,7 +931,7 @@ get_counters(const struct xt_table_info *t, | |||
929 | xt_info_wrlock(cpu); | 931 | xt_info_wrlock(cpu); |
930 | xt_entry_foreach(iter, t->entries[cpu], t->size) { | 932 | xt_entry_foreach(iter, t->entries[cpu], t->size) { |
931 | ADD_COUNTER(counters[i], iter->counters.bcnt, | 933 | ADD_COUNTER(counters[i], iter->counters.bcnt, |
932 | iter->counters.pcnt); | 934 | iter->counters.pcnt); |
933 | ++i; /* macro does multi eval of i */ | 935 | ++i; /* macro does multi eval of i */ |
934 | } | 936 | } |
935 | xt_info_wrunlock(cpu); | 937 | xt_info_wrunlock(cpu); |
@@ -1540,7 +1542,7 @@ check_compat_entry_size_and_hooks(struct compat_ipt_entry *e, | |||
1540 | j = 0; | 1542 | j = 0; |
1541 | xt_ematch_foreach(ematch, e) { | 1543 | xt_ematch_foreach(ematch, e) { |
1542 | ret = compat_find_calc_match(ematch, name, | 1544 | ret = compat_find_calc_match(ematch, name, |
1543 | &e->ip, e->comefrom, &off); | 1545 | &e->ip, e->comefrom, &off); |
1544 | if (ret != 0) | 1546 | if (ret != 0) |
1545 | goto release_matches; | 1547 | goto release_matches; |
1546 | ++j; | 1548 | ++j; |
@@ -1701,8 +1703,11 @@ translate_compat_table(struct net *net, | |||
1701 | /* Walk through entries, checking offsets. */ | 1703 | /* Walk through entries, checking offsets. */ |
1702 | xt_entry_foreach(iter0, entry0, total_size) { | 1704 | xt_entry_foreach(iter0, entry0, total_size) { |
1703 | ret = check_compat_entry_size_and_hooks(iter0, info, &size, | 1705 | ret = check_compat_entry_size_and_hooks(iter0, info, &size, |
1704 | entry0, entry0 + total_size, hook_entries, underflows, | 1706 | entry0, |
1705 | name); | 1707 | entry0 + total_size, |
1708 | hook_entries, | ||
1709 | underflows, | ||
1710 | name); | ||
1706 | if (ret != 0) | 1711 | if (ret != 0) |
1707 | goto out_unlock; | 1712 | goto out_unlock; |
1708 | ++j; | 1713 | ++j; |
@@ -1746,8 +1751,8 @@ translate_compat_table(struct net *net, | |||
1746 | pos = entry1; | 1751 | pos = entry1; |
1747 | size = total_size; | 1752 | size = total_size; |
1748 | xt_entry_foreach(iter0, entry0, total_size) { | 1753 | xt_entry_foreach(iter0, entry0, total_size) { |
1749 | ret = compat_copy_entry_from_user(iter0, &pos, | 1754 | ret = compat_copy_entry_from_user(iter0, &pos, &size, |
1750 | &size, name, newinfo, entry1); | 1755 | name, newinfo, entry1); |
1751 | if (ret != 0) | 1756 | if (ret != 0) |
1752 | break; | 1757 | break; |
1753 | } | 1758 | } |
@@ -1927,7 +1932,7 @@ compat_copy_entries_to_user(unsigned int total_size, struct xt_table *table, | |||
1927 | size = total_size; | 1932 | size = total_size; |
1928 | xt_entry_foreach(iter, loc_cpu_entry, total_size) { | 1933 | xt_entry_foreach(iter, loc_cpu_entry, total_size) { |
1929 | ret = compat_copy_entry_to_user(iter, &pos, | 1934 | ret = compat_copy_entry_to_user(iter, &pos, |
1930 | &size, counters, i++); | 1935 | &size, counters, i++); |
1931 | if (ret != 0) | 1936 | if (ret != 0) |
1932 | break; | 1937 | break; |
1933 | } | 1938 | } |
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c index f7042869198e..9210e312edf1 100644 --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c | |||
@@ -866,8 +866,10 @@ translate_table(struct net *net, struct xt_table_info *newinfo, void *entry0, | |||
866 | /* Walk through entries, checking offsets. */ | 866 | /* Walk through entries, checking offsets. */ |
867 | xt_entry_foreach(iter, entry0, newinfo->size) { | 867 | xt_entry_foreach(iter, entry0, newinfo->size) { |
868 | ret = check_entry_size_and_hooks(iter, newinfo, entry0, | 868 | ret = check_entry_size_and_hooks(iter, newinfo, entry0, |
869 | entry0 + repl->size, repl->hook_entry, repl->underflow, | 869 | entry0 + repl->size, |
870 | repl->valid_hooks); | 870 | repl->hook_entry, |
871 | repl->underflow, | ||
872 | repl->valid_hooks); | ||
871 | if (ret != 0) | 873 | if (ret != 0) |
872 | return ret; | 874 | return ret; |
873 | ++i; | 875 | ++i; |
@@ -948,7 +950,7 @@ get_counters(const struct xt_table_info *t, | |||
948 | i = 0; | 950 | i = 0; |
949 | xt_entry_foreach(iter, t->entries[curcpu], t->size) { | 951 | xt_entry_foreach(iter, t->entries[curcpu], t->size) { |
950 | SET_COUNTER(counters[i], iter->counters.bcnt, | 952 | SET_COUNTER(counters[i], iter->counters.bcnt, |
951 | iter->counters.pcnt); | 953 | iter->counters.pcnt); |
952 | ++i; | 954 | ++i; |
953 | } | 955 | } |
954 | 956 | ||
@@ -959,7 +961,7 @@ get_counters(const struct xt_table_info *t, | |||
959 | xt_info_wrlock(cpu); | 961 | xt_info_wrlock(cpu); |
960 | xt_entry_foreach(iter, t->entries[cpu], t->size) { | 962 | xt_entry_foreach(iter, t->entries[cpu], t->size) { |
961 | ADD_COUNTER(counters[i], iter->counters.bcnt, | 963 | ADD_COUNTER(counters[i], iter->counters.bcnt, |
962 | iter->counters.pcnt); | 964 | iter->counters.pcnt); |
963 | ++i; | 965 | ++i; |
964 | } | 966 | } |
965 | xt_info_wrunlock(cpu); | 967 | xt_info_wrunlock(cpu); |
@@ -1573,7 +1575,7 @@ check_compat_entry_size_and_hooks(struct compat_ip6t_entry *e, | |||
1573 | j = 0; | 1575 | j = 0; |
1574 | xt_ematch_foreach(ematch, e) { | 1576 | xt_ematch_foreach(ematch, e) { |
1575 | ret = compat_find_calc_match(ematch, name, | 1577 | ret = compat_find_calc_match(ematch, name, |
1576 | &e->ipv6, e->comefrom, &off); | 1578 | &e->ipv6, e->comefrom, &off); |
1577 | if (ret != 0) | 1579 | if (ret != 0) |
1578 | goto release_matches; | 1580 | goto release_matches; |
1579 | ++j; | 1581 | ++j; |
@@ -1734,8 +1736,11 @@ translate_compat_table(struct net *net, | |||
1734 | /* Walk through entries, checking offsets. */ | 1736 | /* Walk through entries, checking offsets. */ |
1735 | xt_entry_foreach(iter0, entry0, total_size) { | 1737 | xt_entry_foreach(iter0, entry0, total_size) { |
1736 | ret = check_compat_entry_size_and_hooks(iter0, info, &size, | 1738 | ret = check_compat_entry_size_and_hooks(iter0, info, &size, |
1737 | entry0, entry0 + total_size, hook_entries, underflows, | 1739 | entry0, |
1738 | name); | 1740 | entry0 + total_size, |
1741 | hook_entries, | ||
1742 | underflows, | ||
1743 | name); | ||
1739 | if (ret != 0) | 1744 | if (ret != 0) |
1740 | goto out_unlock; | 1745 | goto out_unlock; |
1741 | ++j; | 1746 | ++j; |
@@ -1779,8 +1784,8 @@ translate_compat_table(struct net *net, | |||
1779 | pos = entry1; | 1784 | pos = entry1; |
1780 | size = total_size; | 1785 | size = total_size; |
1781 | xt_entry_foreach(iter0, entry0, total_size) { | 1786 | xt_entry_foreach(iter0, entry0, total_size) { |
1782 | ret = compat_copy_entry_from_user(iter0, &pos, | 1787 | ret = compat_copy_entry_from_user(iter0, &pos, &size, |
1783 | &size, name, newinfo, entry1); | 1788 | name, newinfo, entry1); |
1784 | if (ret != 0) | 1789 | if (ret != 0) |
1785 | break; | 1790 | break; |
1786 | } | 1791 | } |
@@ -1960,7 +1965,7 @@ compat_copy_entries_to_user(unsigned int total_size, struct xt_table *table, | |||
1960 | size = total_size; | 1965 | size = total_size; |
1961 | xt_entry_foreach(iter, loc_cpu_entry, total_size) { | 1966 | xt_entry_foreach(iter, loc_cpu_entry, total_size) { |
1962 | ret = compat_copy_entry_to_user(iter, &pos, | 1967 | ret = compat_copy_entry_to_user(iter, &pos, |
1963 | &size, counters, i++); | 1968 | &size, counters, i++); |
1964 | if (ret != 0) | 1969 | if (ret != 0) |
1965 | break; | 1970 | break; |
1966 | } | 1971 | } |
diff --git a/net/netfilter/ipvs/ip_vs_lblcr.c b/net/netfilter/ipvs/ip_vs_lblcr.c index f7476b95ab46..caa58fa1438a 100644 --- a/net/netfilter/ipvs/ip_vs_lblcr.c +++ b/net/netfilter/ipvs/ip_vs_lblcr.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/kernel.h> | 45 | #include <linux/kernel.h> |
46 | #include <linux/skbuff.h> | 46 | #include <linux/skbuff.h> |
47 | #include <linux/jiffies.h> | 47 | #include <linux/jiffies.h> |
48 | #include <linux/list.h> | ||
48 | 49 | ||
49 | /* for sysctl */ | 50 | /* for sysctl */ |
50 | #include <linux/fs.h> | 51 | #include <linux/fs.h> |
@@ -85,25 +86,25 @@ static int sysctl_ip_vs_lblcr_expiration = 24*60*60*HZ; | |||
85 | /* | 86 | /* |
86 | * IPVS destination set structure and operations | 87 | * IPVS destination set structure and operations |
87 | */ | 88 | */ |
88 | struct ip_vs_dest_list { | 89 | struct ip_vs_dest_set_elem { |
89 | struct ip_vs_dest_list *next; /* list link */ | 90 | struct list_head list; /* list link */ |
90 | struct ip_vs_dest *dest; /* destination server */ | 91 | struct ip_vs_dest *dest; /* destination server */ |
91 | }; | 92 | }; |
92 | 93 | ||
93 | struct ip_vs_dest_set { | 94 | struct ip_vs_dest_set { |
94 | atomic_t size; /* set size */ | 95 | atomic_t size; /* set size */ |
95 | unsigned long lastmod; /* last modified time */ | 96 | unsigned long lastmod; /* last modified time */ |
96 | struct ip_vs_dest_list *list; /* destination list */ | 97 | struct list_head list; /* destination list */ |
97 | rwlock_t lock; /* lock for this list */ | 98 | rwlock_t lock; /* lock for this list */ |
98 | }; | 99 | }; |
99 | 100 | ||
100 | 101 | ||
101 | static struct ip_vs_dest_list * | 102 | static struct ip_vs_dest_set_elem * |
102 | ip_vs_dest_set_insert(struct ip_vs_dest_set *set, struct ip_vs_dest *dest) | 103 | ip_vs_dest_set_insert(struct ip_vs_dest_set *set, struct ip_vs_dest *dest) |
103 | { | 104 | { |
104 | struct ip_vs_dest_list *e; | 105 | struct ip_vs_dest_set_elem *e; |
105 | 106 | ||
106 | for (e=set->list; e!=NULL; e=e->next) { | 107 | list_for_each_entry(e, &set->list, list) { |
107 | if (e->dest == dest) | 108 | if (e->dest == dest) |
108 | /* already existed */ | 109 | /* already existed */ |
109 | return NULL; | 110 | return NULL; |
@@ -118,9 +119,7 @@ ip_vs_dest_set_insert(struct ip_vs_dest_set *set, struct ip_vs_dest *dest) | |||
118 | atomic_inc(&dest->refcnt); | 119 | atomic_inc(&dest->refcnt); |
119 | e->dest = dest; | 120 | e->dest = dest; |
120 | 121 | ||
121 | /* link it to the list */ | 122 | list_add(&e->list, &set->list); |
122 | e->next = set->list; | ||
123 | set->list = e; | ||
124 | atomic_inc(&set->size); | 123 | atomic_inc(&set->size); |
125 | 124 | ||
126 | set->lastmod = jiffies; | 125 | set->lastmod = jiffies; |
@@ -130,34 +129,33 @@ ip_vs_dest_set_insert(struct ip_vs_dest_set *set, struct ip_vs_dest *dest) | |||
130 | static void | 129 | static void |
131 | ip_vs_dest_set_erase(struct ip_vs_dest_set *set, struct ip_vs_dest *dest) | 130 | ip_vs_dest_set_erase(struct ip_vs_dest_set *set, struct ip_vs_dest *dest) |
132 | { | 131 | { |
133 | struct ip_vs_dest_list *e, **ep; | 132 | struct ip_vs_dest_set_elem *e; |
134 | 133 | ||
135 | for (ep=&set->list, e=*ep; e!=NULL; e=*ep) { | 134 | list_for_each_entry(e, &set->list, list) { |
136 | if (e->dest == dest) { | 135 | if (e->dest == dest) { |
137 | /* HIT */ | 136 | /* HIT */ |
138 | *ep = e->next; | ||
139 | atomic_dec(&set->size); | 137 | atomic_dec(&set->size); |
140 | set->lastmod = jiffies; | 138 | set->lastmod = jiffies; |
141 | atomic_dec(&e->dest->refcnt); | 139 | atomic_dec(&e->dest->refcnt); |
140 | list_del(&e->list); | ||
142 | kfree(e); | 141 | kfree(e); |
143 | break; | 142 | break; |
144 | } | 143 | } |
145 | ep = &e->next; | ||
146 | } | 144 | } |
147 | } | 145 | } |
148 | 146 | ||
149 | static void ip_vs_dest_set_eraseall(struct ip_vs_dest_set *set) | 147 | static void ip_vs_dest_set_eraseall(struct ip_vs_dest_set *set) |
150 | { | 148 | { |
151 | struct ip_vs_dest_list *e, **ep; | 149 | struct ip_vs_dest_set_elem *e, *ep; |
152 | 150 | ||
153 | write_lock(&set->lock); | 151 | write_lock(&set->lock); |
154 | for (ep=&set->list, e=*ep; e!=NULL; e=*ep) { | 152 | list_for_each_entry_safe(e, ep, &set->list, list) { |
155 | *ep = e->next; | ||
156 | /* | 153 | /* |
157 | * We don't kfree dest because it is refered either | 154 | * We don't kfree dest because it is refered either |
158 | * by its service or by the trash dest list. | 155 | * by its service or by the trash dest list. |
159 | */ | 156 | */ |
160 | atomic_dec(&e->dest->refcnt); | 157 | atomic_dec(&e->dest->refcnt); |
158 | list_del(&e->list); | ||
161 | kfree(e); | 159 | kfree(e); |
162 | } | 160 | } |
163 | write_unlock(&set->lock); | 161 | write_unlock(&set->lock); |
@@ -166,7 +164,7 @@ static void ip_vs_dest_set_eraseall(struct ip_vs_dest_set *set) | |||
166 | /* get weighted least-connection node in the destination set */ | 164 | /* get weighted least-connection node in the destination set */ |
167 | static inline struct ip_vs_dest *ip_vs_dest_set_min(struct ip_vs_dest_set *set) | 165 | static inline struct ip_vs_dest *ip_vs_dest_set_min(struct ip_vs_dest_set *set) |
168 | { | 166 | { |
169 | register struct ip_vs_dest_list *e; | 167 | register struct ip_vs_dest_set_elem *e; |
170 | struct ip_vs_dest *dest, *least; | 168 | struct ip_vs_dest *dest, *least; |
171 | int loh, doh; | 169 | int loh, doh; |
172 | 170 | ||
@@ -174,7 +172,7 @@ static inline struct ip_vs_dest *ip_vs_dest_set_min(struct ip_vs_dest_set *set) | |||
174 | return NULL; | 172 | return NULL; |
175 | 173 | ||
176 | /* select the first destination server, whose weight > 0 */ | 174 | /* select the first destination server, whose weight > 0 */ |
177 | for (e=set->list; e!=NULL; e=e->next) { | 175 | list_for_each_entry(e, &set->list, list) { |
178 | least = e->dest; | 176 | least = e->dest; |
179 | if (least->flags & IP_VS_DEST_F_OVERLOAD) | 177 | if (least->flags & IP_VS_DEST_F_OVERLOAD) |
180 | continue; | 178 | continue; |
@@ -190,7 +188,7 @@ static inline struct ip_vs_dest *ip_vs_dest_set_min(struct ip_vs_dest_set *set) | |||
190 | 188 | ||
191 | /* find the destination with the weighted least load */ | 189 | /* find the destination with the weighted least load */ |
192 | nextstage: | 190 | nextstage: |
193 | for (e=e->next; e!=NULL; e=e->next) { | 191 | list_for_each_entry(e, &set->list, list) { |
194 | dest = e->dest; | 192 | dest = e->dest; |
195 | if (dest->flags & IP_VS_DEST_F_OVERLOAD) | 193 | if (dest->flags & IP_VS_DEST_F_OVERLOAD) |
196 | continue; | 194 | continue; |
@@ -220,7 +218,7 @@ static inline struct ip_vs_dest *ip_vs_dest_set_min(struct ip_vs_dest_set *set) | |||
220 | /* get weighted most-connection node in the destination set */ | 218 | /* get weighted most-connection node in the destination set */ |
221 | static inline struct ip_vs_dest *ip_vs_dest_set_max(struct ip_vs_dest_set *set) | 219 | static inline struct ip_vs_dest *ip_vs_dest_set_max(struct ip_vs_dest_set *set) |
222 | { | 220 | { |
223 | register struct ip_vs_dest_list *e; | 221 | register struct ip_vs_dest_set_elem *e; |
224 | struct ip_vs_dest *dest, *most; | 222 | struct ip_vs_dest *dest, *most; |
225 | int moh, doh; | 223 | int moh, doh; |
226 | 224 | ||
@@ -228,7 +226,7 @@ static inline struct ip_vs_dest *ip_vs_dest_set_max(struct ip_vs_dest_set *set) | |||
228 | return NULL; | 226 | return NULL; |
229 | 227 | ||
230 | /* select the first destination server, whose weight > 0 */ | 228 | /* select the first destination server, whose weight > 0 */ |
231 | for (e=set->list; e!=NULL; e=e->next) { | 229 | list_for_each_entry(e, &set->list, list) { |
232 | most = e->dest; | 230 | most = e->dest; |
233 | if (atomic_read(&most->weight) > 0) { | 231 | if (atomic_read(&most->weight) > 0) { |
234 | moh = atomic_read(&most->activeconns) * 50 | 232 | moh = atomic_read(&most->activeconns) * 50 |
@@ -240,7 +238,7 @@ static inline struct ip_vs_dest *ip_vs_dest_set_max(struct ip_vs_dest_set *set) | |||
240 | 238 | ||
241 | /* find the destination with the weighted most load */ | 239 | /* find the destination with the weighted most load */ |
242 | nextstage: | 240 | nextstage: |
243 | for (e=e->next; e!=NULL; e=e->next) { | 241 | list_for_each_entry(e, &set->list, list) { |
244 | dest = e->dest; | 242 | dest = e->dest; |
245 | doh = atomic_read(&dest->activeconns) * 50 | 243 | doh = atomic_read(&dest->activeconns) * 50 |
246 | + atomic_read(&dest->inactconns); | 244 | + atomic_read(&dest->inactconns); |
@@ -389,7 +387,7 @@ ip_vs_lblcr_new(struct ip_vs_lblcr_table *tbl, const union nf_inet_addr *daddr, | |||
389 | 387 | ||
390 | /* initilize its dest set */ | 388 | /* initilize its dest set */ |
391 | atomic_set(&(en->set.size), 0); | 389 | atomic_set(&(en->set.size), 0); |
392 | en->set.list = NULL; | 390 | INIT_LIST_HEAD(&en->set.list); |
393 | rwlock_init(&en->set.lock); | 391 | rwlock_init(&en->set.lock); |
394 | 392 | ||
395 | ip_vs_lblcr_hash(tbl, en); | 393 | ip_vs_lblcr_hash(tbl, en); |
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index 285e9029a9ff..d9b8fb8ab340 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c | |||
@@ -768,7 +768,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, | |||
768 | } | 768 | } |
769 | 769 | ||
770 | instance_destroy(inst); | 770 | instance_destroy(inst); |
771 | goto out; | 771 | goto out_put; |
772 | default: | 772 | default: |
773 | ret = -ENOTSUPP; | 773 | ret = -ENOTSUPP; |
774 | break; | 774 | break; |