Re: [PATCH] ipvs: remove unnecessary space
ok I will remove all unnecessary spaces and send the v2 patch Thansk Pablo Pablo Neira Ayuso 于2019年7月15日周一 下午4:27写道: > > On Wed, Jul 10, 2019 at 10:06:09AM +0200, Simon Horman wrote: > > On Wed, Jul 10, 2019 at 03:45:52PM +0800, yangxingwu wrote: > > > --- > > > net/netfilter/ipvs/ip_vs_mh.c | 4 ++-- > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > diff --git a/net/netfilter/ipvs/ip_vs_mh.c b/net/netfilter/ipvs/ip_vs_mh.c > > > index 94d9d34..98e358e 100644 > > > --- a/net/netfilter/ipvs/ip_vs_mh.c > > > +++ b/net/netfilter/ipvs/ip_vs_mh.c > > > @@ -174,8 +174,8 @@ static int ip_vs_mh_populate(struct ip_vs_mh_state *s, > > > return 0; > > > } > > > > > > - table = kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE), > > > -sizeof(unsigned long), GFP_KERNEL); > > > + table = kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE), > > > + sizeof(unsigned long), GFP_KERNEL); > > May I ask one thing? :-) > > Please, remove all unnecessary spaces in one go, search for: > > git grep "= " > > in the netfilter tree, and send a v2 for this one. > > Thanks.
[PATCH v2] net/netfilter: remove unnecessary spaces
this patch removes extra spaces Signed-off-by: yangxingwu --- net/netfilter/ipset/ip_set_hash_gen.h | 2 +- net/netfilter/ipset/ip_set_list_set.c | 2 +- net/netfilter/ipvs/ip_vs_core.c| 2 +- net/netfilter/ipvs/ip_vs_mh.c | 4 ++-- net/netfilter/ipvs/ip_vs_proto_tcp.c | 2 +- net/netfilter/nf_conntrack_ftp.c | 2 +- net/netfilter/nf_conntrack_proto_tcp.c | 2 +- net/netfilter/nfnetlink_log.c | 4 ++-- net/netfilter/nfnetlink_queue.c| 4 ++-- net/netfilter/xt_IDLETIMER.c | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/net/netfilter/ipset/ip_set_hash_gen.h b/net/netfilter/ipset/ip_set_hash_gen.h index 10f6196..eb907d2 100644 --- a/net/netfilter/ipset/ip_set_hash_gen.h +++ b/net/netfilter/ipset/ip_set_hash_gen.h @@ -954,7 +954,7 @@ struct htype { mtype_data_netmask(d, NCIDR_GET(h->nets[j].cidr[0])); #endif key = HKEY(d, h->initval, t->htable_bits); - n = rcu_dereference_bh(hbucket(t, key)); + n = rcu_dereference_bh(hbucket(t, key)); if (!n) continue; for (i = 0; i < n->pos; i++) { diff --git a/net/netfilter/ipset/ip_set_list_set.c b/net/netfilter/ipset/ip_set_list_set.c index 8ada318..5c2be76 100644 --- a/net/netfilter/ipset/ip_set_list_set.c +++ b/net/netfilter/ipset/ip_set_list_set.c @@ -289,7 +289,7 @@ struct list_set { if (n && !(SET_WITH_TIMEOUT(set) && ip_set_timeout_expired(ext_timeout(n, set - n = NULL; + n = NULL; e = kzalloc(set->dsize, GFP_ATOMIC); if (!e) diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c index 7138556..6b3ae76 100644 --- a/net/netfilter/ipvs/ip_vs_core.c +++ b/net/netfilter/ipvs/ip_vs_core.c @@ -615,7 +615,7 @@ int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, unsigned int flags = (svc->flags & IP_VS_SVC_F_ONEPACKET && iph->protocol == IPPROTO_UDP) ? IP_VS_CONN_F_ONE_PACKET : 0; - union nf_inet_addr daddr = { .all = { 0, 0, 0, 0 } }; + union nf_inet_addr daddr = { .all = { 0, 0, 0, 0 } }; /* create a new connection entry */ IP_VS_DBG(6, "%s(): create a cache_bypass entry\n", __func__); diff --git a/net/netfilter/ipvs/ip_vs_mh.c b/net/netfilter/ipvs/ip_vs_mh.c index 94d9d34..da0280c 100644 --- a/net/netfilter/ipvs/ip_vs_mh.c +++ b/net/netfilter/ipvs/ip_vs_mh.c @@ -174,8 +174,8 @@ static int ip_vs_mh_populate(struct ip_vs_mh_state *s, return 0; } - table = kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE), -sizeof(unsigned long), GFP_KERNEL); + table = kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE), + sizeof(unsigned long), GFP_KERNEL); if (!table) return -ENOMEM; diff --git a/net/netfilter/ipvs/ip_vs_proto_tcp.c b/net/netfilter/ipvs/ip_vs_proto_tcp.c index 915ac82..c7b46a9 100644 --- a/net/netfilter/ipvs/ip_vs_proto_tcp.c +++ b/net/netfilter/ipvs/ip_vs_proto_tcp.c @@ -710,7 +710,7 @@ static int __ip_vs_tcp_init(struct netns_ipvs *ipvs, struct ip_vs_proto_data *pd sizeof(tcp_timeouts)); if (!pd->timeout_table) return -ENOMEM; - pd->tcp_state_table = tcp_states; + pd->tcp_state_table = tcp_states; return 0; } diff --git a/net/netfilter/nf_conntrack_ftp.c b/net/netfilter/nf_conntrack_ftp.c index 8c6c11b..26c1ff8 100644 --- a/net/netfilter/nf_conntrack_ftp.c +++ b/net/netfilter/nf_conntrack_ftp.c @@ -162,7 +162,7 @@ static int try_rfc959(const char *data, size_t dlen, if (length == 0) return 0; - cmd->u3.ip = htonl((array[0] << 24) | (array[1] << 16) | + cmd->u3.ip = htonl((array[0] << 24) | (array[1] << 16) | (array[2] << 8) | array[3]); cmd->u.tcp.port = htons((array[4] << 8) | array[5]); return length; diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c index 1e2cc83..48f3a67 100644 --- a/net/netfilter/nf_conntrack_proto_tcp.c +++ b/net/netfilter/nf_conntrack_proto_tcp.c @@ -1225,7 +1225,7 @@ static int tcp_to_nlattr(struct sk_buff *skb, struct nlattr *nla, [CTA_PROTOINFO_TCP_WSCALE_ORIGINAL] = { .type = NLA_U8 }, [CTA_PROTOINFO_TCP_WSCALE_REPLY]= { .type = NLA_U8 }, [CTA_PROTOINFO_TCP_FLAGS_ORIGINAL] = { .len = sizeof(struct nf_ct_tcp_flags) }, - [CTA_PROTOINFO_TCP_FLAGS_REPLY] = { .len = sizeof(struct nf_ct_tcp_flags) }, + [CTA_PROTOINFO_TCP_FLAGS_REPLY] = { .len = sizeof(struct nf_ct_tcp_flags) }, };
Re: [PATCH] ipvs: remove unnecessary space
Pablo v2 has been sent I made the following changes: 1. remove all unnecessary spaces in one go 2. revert bitmap_alloc ( since it's irrelevant to this subject) 3. chenge subject to "net/netfiler:remove unnecessary space" thanks Pablo Neira Ayuso 于2019年7月15日周一 下午4:27写道: > > On Wed, Jul 10, 2019 at 10:06:09AM +0200, Simon Horman wrote: > > On Wed, Jul 10, 2019 at 03:45:52PM +0800, yangxingwu wrote: > > > --- > > > net/netfilter/ipvs/ip_vs_mh.c | 4 ++-- > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > diff --git a/net/netfilter/ipvs/ip_vs_mh.c b/net/netfilter/ipvs/ip_vs_mh.c > > > index 94d9d34..98e358e 100644 > > > --- a/net/netfilter/ipvs/ip_vs_mh.c > > > +++ b/net/netfilter/ipvs/ip_vs_mh.c > > > @@ -174,8 +174,8 @@ static int ip_vs_mh_populate(struct ip_vs_mh_state *s, > > > return 0; > > > } > > > > > > - table = kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE), > > > -sizeof(unsigned long), GFP_KERNEL); > > > + table = kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE), > > > + sizeof(unsigned long), GFP_KERNEL); > > May I ask one thing? :-) > > Please, remove all unnecessary spaces in one go, search for: > > git grep "= " > > in the netfilter tree, and send a v2 for this one. > > Thanks.
[PATCH] ipvs: remove unnecessary space
this patch removes the extra space and use bitmap_zalloc instead Signed-off-by: yangxingwu --- net/netfilter/ipvs/ip_vs_mh.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/netfilter/ipvs/ip_vs_mh.c b/net/netfilter/ipvs/ip_vs_mh.c index 94d9d34..3229867 100644 --- a/net/netfilter/ipvs/ip_vs_mh.c +++ b/net/netfilter/ipvs/ip_vs_mh.c @@ -174,8 +174,7 @@ static int ip_vs_mh_populate(struct ip_vs_mh_state *s, return 0; } - table = kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE), -sizeof(unsigned long), GFP_KERNEL); + table = bitmap_zalloc(IP_VS_MH_TAB_SIZE, GFP_KERNEL); if (!table) return -ENOMEM; -- 1.8.3.1
Re: [PATCH v2] net/netfilter: remove unnecessary spaces
Thansk Pablo Pablo Neira Ayuso 于2019年7月19日周五 上午2:26写道: > > Looks good, but you will have to wait until net-next reopens: > > http://vger.kernel.org/~davem/net-next.html > > Will keep this in my patchwork until that happens. > > Thanks. > > On Tue, Jul 16, 2019 at 10:13:01AM +0800, yangxingwu wrote: > > this patch removes extra spaces > > > > Signed-off-by: yangxingwu > > --- > > net/netfilter/ipset/ip_set_hash_gen.h | 2 +- > > net/netfilter/ipset/ip_set_list_set.c | 2 +- > > net/netfilter/ipvs/ip_vs_core.c| 2 +- > > net/netfilter/ipvs/ip_vs_mh.c | 4 ++-- > > net/netfilter/ipvs/ip_vs_proto_tcp.c | 2 +- > > net/netfilter/nf_conntrack_ftp.c | 2 +- > > net/netfilter/nf_conntrack_proto_tcp.c | 2 +- > > net/netfilter/nfnetlink_log.c | 4 ++-- > > net/netfilter/nfnetlink_queue.c| 4 ++-- > > net/netfilter/xt_IDLETIMER.c | 2 +- > > 10 files changed, 13 insertions(+), 13 deletions(-) > > > > diff --git a/net/netfilter/ipset/ip_set_hash_gen.h > > b/net/netfilter/ipset/ip_set_hash_gen.h > > index 10f6196..eb907d2 100644 > > --- a/net/netfilter/ipset/ip_set_hash_gen.h > > +++ b/net/netfilter/ipset/ip_set_hash_gen.h > > @@ -954,7 +954,7 @@ struct htype { > > mtype_data_netmask(d, NCIDR_GET(h->nets[j].cidr[0])); > > #endif > > key = HKEY(d, h->initval, t->htable_bits); > > - n = rcu_dereference_bh(hbucket(t, key)); > > + n = rcu_dereference_bh(hbucket(t, key)); > > if (!n) > > continue; > > for (i = 0; i < n->pos; i++) { > > diff --git a/net/netfilter/ipset/ip_set_list_set.c > > b/net/netfilter/ipset/ip_set_list_set.c > > index 8ada318..5c2be76 100644 > > --- a/net/netfilter/ipset/ip_set_list_set.c > > +++ b/net/netfilter/ipset/ip_set_list_set.c > > @@ -289,7 +289,7 @@ struct list_set { > > if (n && > > !(SET_WITH_TIMEOUT(set) && > > ip_set_timeout_expired(ext_timeout(n, set > > - n = NULL; > > + n = NULL; > > > > e = kzalloc(set->dsize, GFP_ATOMIC); > > if (!e) > > diff --git a/net/netfilter/ipvs/ip_vs_core.c > > b/net/netfilter/ipvs/ip_vs_core.c > > index 7138556..6b3ae76 100644 > > --- a/net/netfilter/ipvs/ip_vs_core.c > > +++ b/net/netfilter/ipvs/ip_vs_core.c > > @@ -615,7 +615,7 @@ int ip_vs_leave(struct ip_vs_service *svc, struct > > sk_buff *skb, > > unsigned int flags = (svc->flags & IP_VS_SVC_F_ONEPACKET && > > iph->protocol == IPPROTO_UDP) ? > > IP_VS_CONN_F_ONE_PACKET : 0; > > - union nf_inet_addr daddr = { .all = { 0, 0, 0, 0 } }; > > + union nf_inet_addr daddr = { .all = { 0, 0, 0, 0 } }; > > > > /* create a new connection entry */ > > IP_VS_DBG(6, "%s(): create a cache_bypass entry\n", __func__); > > diff --git a/net/netfilter/ipvs/ip_vs_mh.c b/net/netfilter/ipvs/ip_vs_mh.c > > index 94d9d34..da0280c 100644 > > --- a/net/netfilter/ipvs/ip_vs_mh.c > > +++ b/net/netfilter/ipvs/ip_vs_mh.c > > @@ -174,8 +174,8 @@ static int ip_vs_mh_populate(struct ip_vs_mh_state *s, > > return 0; > > } > > > > - table = kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE), > > - sizeof(unsigned long), GFP_KERNEL); > > + table = kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE), > > + sizeof(unsigned long), GFP_KERNEL); > > if (!table) > > return -ENOMEM; > > > > diff --git a/net/netfilter/ipvs/ip_vs_proto_tcp.c > > b/net/netfilter/ipvs/ip_vs_proto_tcp.c > > index 915ac82..c7b46a9 100644 > > --- a/net/netfilter/ipvs/ip_vs_proto_tcp.c > > +++ b/net/netfilter/ipvs/ip_vs_proto_tcp.c > > @@ -710,7 +710,7 @@ static int __ip_vs_tcp_init(struct netns_ipvs *ipvs, > > struct ip_vs_proto_data *pd > > sizeof(tcp_timeouts)); > > if (!pd->timeout_table) > > return -ENOMEM; > > - pd->tcp_state_table = tcp_states; > > + pd->tcp_state_table = tcp_states; > > return 0; > > } > > > > diff --git a/net/netfilter/nf_conntrack_ftp.c > > b/net/netfilter/nf_conntrack_ftp.c > > index 8c6c11b..26c1ff8 100644 > > --- a/net/netfilter/nf_conntrack_ftp.c > > +++ b/ne
[PATCH] ipvs: remove unnecessary space
this patch removes the extra space. Signed-off-by: yangxingwu --- net/netfilter/ipvs/ip_vs_mh.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/netfilter/ipvs/ip_vs_mh.c b/net/netfilter/ipvs/ip_vs_mh.c index 94d9d34..98e358e 100644 --- a/net/netfilter/ipvs/ip_vs_mh.c +++ b/net/netfilter/ipvs/ip_vs_mh.c @@ -174,8 +174,8 @@ static int ip_vs_mh_populate(struct ip_vs_mh_state *s, return 0; } - table = kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE), -sizeof(unsigned long), GFP_KERNEL); + table = kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE), + sizeof(unsigned long), GFP_KERNEL); if (!table) return -ENOMEM; -- 1.8.3.1
[PATCH] ipv6: Use ipv6_authlen for len
The length of AH header is computed manually as (hp->hdrlen+2)<<2. However, in include/linux/ipv6.h, a macro named ipv6_authlen is already defined for exactly the same job. This commit replaces the manual computation code with the macro. Signed-off-by: yangxingwu --- net/ipv6/ah6.c | 4 ++-- net/ipv6/exthdrs_core.c | 2 +- net/ipv6/ip6_tunnel.c | 2 +- net/ipv6/netfilter/ip6t_ah.c| 2 +- net/ipv6/netfilter/ip6t_ipv6header.c| 2 +- net/ipv6/netfilter/nf_conntrack_reasm.c | 2 +- net/ipv6/netfilter/nf_log_ipv6.c| 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c index 68b9e92..626c64b 100644 --- a/net/ipv6/ah6.c +++ b/net/ipv6/ah6.c @@ -464,7 +464,7 @@ static void ah6_input_done(struct crypto_async_request *base, int err) struct ah_data *ahp = x->data; struct ip_auth_hdr *ah = ip_auth_hdr(skb); int hdr_len = skb_network_header_len(skb); - int ah_hlen = (ah->hdrlen + 2) << 2; + int ah_hlen = ipv6_authlen(ah); if (err) goto out; @@ -546,7 +546,7 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb) ahash = ahp->ahash; nexthdr = ah->nexthdr; - ah_hlen = (ah->hdrlen + 2) << 2; + ah_hlen = ipv6_authlen(ah); if (ah_hlen != XFRM_ALIGN8(sizeof(*ah) + ahp->icv_full_len) && ah_hlen != XFRM_ALIGN8(sizeof(*ah) + ahp->icv_trunc_len)) diff --git a/net/ipv6/exthdrs_core.c b/net/ipv6/exthdrs_core.c index 11a43ee..b358f1a 100644 --- a/net/ipv6/exthdrs_core.c +++ b/net/ipv6/exthdrs_core.c @@ -266,7 +266,7 @@ int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, } else if (nexthdr == NEXTHDR_AUTH) { if (flags && (*flags & IP6_FH_F_AUTH) && (target < 0)) break; - hdrlen = (hp->hdrlen + 2) << 2; + hdrlen = ipv6_authlen(hp); } else hdrlen = ipv6_optlen(hp); diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index b80fde1..3134fbb 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c @@ -416,7 +416,7 @@ __u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw) break; optlen = 8; } else if (nexthdr == NEXTHDR_AUTH) { - optlen = (hdr->hdrlen + 2) << 2; + optlen = ipv6_authlen(hdr); } else { optlen = ipv6_optlen(hdr); } diff --git a/net/ipv6/netfilter/ip6t_ah.c b/net/ipv6/netfilter/ip6t_ah.c index 0228ff3..4e15a14 100644 --- a/net/ipv6/netfilter/ip6t_ah.c +++ b/net/ipv6/netfilter/ip6t_ah.c @@ -55,7 +55,7 @@ static bool ah_mt6(const struct sk_buff *skb, struct xt_action_param *par) return false; } - hdrlen = (ah->hdrlen + 2) << 2; + hdrlen = ipv6_authlen(ah); pr_debug("IPv6 AH LEN %u %u ", hdrlen, ah->hdrlen); pr_debug("RES %04X ", ah->reserved); diff --git a/net/ipv6/netfilter/ip6t_ipv6header.c b/net/ipv6/netfilter/ip6t_ipv6header.c index fd439f8..0fc6326 100644 --- a/net/ipv6/netfilter/ip6t_ipv6header.c +++ b/net/ipv6/netfilter/ip6t_ipv6header.c @@ -71,7 +71,7 @@ if (nexthdr == NEXTHDR_FRAGMENT) hdrlen = 8; else if (nexthdr == NEXTHDR_AUTH) - hdrlen = (hp->hdrlen + 2) << 2; + hdrlen = ipv6_authlen(hp); else hdrlen = ipv6_optlen(hp); diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c index 84322ce..16de015 100644 --- a/net/ipv6/netfilter/nf_conntrack_reasm.c +++ b/net/ipv6/netfilter/nf_conntrack_reasm.c @@ -421,7 +421,7 @@ static int nf_ct_frag6_reasm(struct frag_queue *fq, struct sk_buff *skb, if (skb_copy_bits(skb, start, &hdr, sizeof(hdr))) BUG(); if (nexthdr == NEXTHDR_AUTH) - hdrlen = (hdr.hdrlen+2)<<2; + hdrlen = ipv6_authlen(&hdr); else hdrlen = ipv6_optlen(&hdr); diff --git a/net/ipv6/netfilter/nf_log_ipv6.c b/net/ipv6/netfilter/nf_log_ipv6.c index 549c511..f53bd8f 100644 --- a/net/ipv6/netfilter/nf_log_ipv6.c +++ b/net/ipv6/netfilter/nf_log_ipv6.c @@ -155,7 +155,7 @@ static void dump_ipv6_packet(struct net *net, struct nf_log_buf *m, } - hdrlen = (hp->hdrlen+2)<<2; + hdrlen = ipv6_authlen(hp); break; case IPPROTO_ESP: if (logflags & NF_LOG_IPOPT) { -- 1.8.3.1
[PATCH] ipvs: remove unnecessary space
this patch removes the extra space and use bitmap_zalloc instead Signed-off-by: yangxingwu --- net/netfilter/ipvs/ip_vs_mh.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/netfilter/ipvs/ip_vs_mh.c b/net/netfilter/ipvs/ip_vs_mh.c index 94d9d34..3229867 100644 --- a/net/netfilter/ipvs/ip_vs_mh.c +++ b/net/netfilter/ipvs/ip_vs_mh.c @@ -174,8 +174,7 @@ static int ip_vs_mh_populate(struct ip_vs_mh_state *s, return 0; } - table = kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE), -sizeof(unsigned long), GFP_KERNEL); + table = bitmap_zalloc(IP_VS_MH_TAB_SIZE, GFP_KERNEL); if (!table) return -ENOMEM; -- 1.8.3.1