[PATCH] net: netfilter: fix coding style

2017-12-04 Thread Lin Zhang
I think use variable 'min' instead of number '1024' is better. Signed-off-by: Lin Zhang <xiaolou4...@gmail.com> --- net/netfilter/nf_nat_proto_common.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/netfilter/nf_nat_proto_common.c b/net/net

[PATCH] net: ipv6: remove unused code in ipv6_find_hdr()

2017-10-05 Thread Lin Zhang
Storing the left length of skb into 'len' actually has no effect so we can remove it. Signed-off-by: Lin Zhang <xiaolou4...@gmail.com> --- net/ipv6/exthdrs_core.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/net/ipv6/exthdrs_core.c b/net/ipv6/exthdrs_core.c index 305e2ed..9

[PATCH v3 2/2] net: phonet: mark phonet_protocol as const

2017-10-05 Thread Lin Zhang
The phonet_protocol structs don't need to be written by anyone and so can be marked as const. Signed-off-by: Lin Zhang <xiaolou4...@gmail.com> --- changelog: v1 -> v2: * remove __read_mostly tag v2 -> v3: * revert __read_mostly tag --- include/net/phonet/p

[PATCH v3 1/2] net: phonet: mark header_ops as const

2017-10-05 Thread Lin Zhang
Signed-off-by: Lin Zhang <xiaolou4...@gmail.com> --- changelog: v2 -> v3: * fix phonet_header_ops type mismatch error --- include/linux/if_phonet.h | 2 +- net/phonet/af_phonet.c| 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/if_phonet.h

[PATCH v3] netfilter: SYNPROXY: fix process non tcp packet bug in {ipv4,ipv6}_synproxy_hook

2017-10-05 Thread Lin Zhang
In function {ipv4,ipv6}_synproxy_hook we expect a normal tcp packet, but the real server maybe reply an icmp error packet related to the exist tcp conntrack, so we will access wrong tcp data. For fix it, check for the protocol field and only process tcp traffic. Signed-off-by: Lin Zhang

[PATCH v2] netfilter: SYNPROXY: fix process non tcp packet bug in {ipv4,ipv6}_synproxy_hook

2017-09-30 Thread Lin Zhang
In function {ipv4,ipv6}_synproxy_hook we expect a normal tcp packet, but the real server maybe reply an icmp error packet related to the exist tcp conntrack, so we will access wrong tcp data. For fix it, check for the protocol field and only process tcp traffic. Signed-off-by: Lin Zhang

[PATCH v2 2/2] net: phonet: mark phonet_protocol as const

2017-09-30 Thread Lin Zhang
The phonet_protocol structs don't need to be written by anyone and so can be marked as const. Signed-off-by: Lin Zhang <xiaolou4...@gmail.com> --- changelog: v1 -> v2: * remove __read_mostly tag --- include/net/phonet/phonet.h | 6 -- net/phonet/af_phonet.c

[PATCH v2 1/2] net: phonet: mark header_ops as const

2017-09-30 Thread Lin Zhang
Signed-off-by: Lin Zhang <xiaolou4...@gmail.com> --- net/phonet/af_phonet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c index f925753..b12142e 100644 --- a/net/phonet/af_phonet.c +++ b/net/phonet/af_phonet.c @@ -149,7

[PATCH 2/2] net: phonet: mark phonet_protocol as const

2017-09-30 Thread Lin Zhang
The phonet_protocol structs don't need to be written by anyone and so can be marked as const. Signed-off-by: Lin Zhang <xiaolou4...@gmail.com> --- include/net/phonet/phonet.h | 6 -- net/phonet/af_phonet.c | 15 --- net/phonet/datagram.c | 2 +- net/phonet

[PATCH 1/2] net: phonet: mark header_ops as const

2017-09-30 Thread Lin Zhang
Signed-off-by: Lin Zhang <xiaolou4...@gmail.com> --- net/phonet/af_phonet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c index f925753..b12142e 100644 --- a/net/phonet/af_phonet.c +++ b/net/phonet/af_phonet.c @@ -149,7

[PATCH] netfilter: SYNPROXY: fix process non tcp packet bug in {ipv4,ipv6}_synproxy_hook

2017-07-28 Thread Lin Zhang
In function {ipv4,ipv6}_synproxy_hook we expect a normal tcp packet, but the real server maybe reply an icmp error packet related to the exist tcp conntrack, so we will access wrong tcp data. For fix it, we simply pass IP_CT_RELATED_REPLY packets. Signed-off-by: Lin Zhang <xiaolou4...@gmail.

[PATCH net-next v2 resubmit] skbuff: optimize the pull_pages code in __pskb_pull_tail()

2017-07-17 Thread Lin Zhang
In the pull_pages code block, if the first frag size > eat, we can end the loop in advance to avoid extra copy. Signed-off-by: Lin Zhang <xiaolou4...@gmail.com> --- v1 -> v2: * no need to rewrite skb_shinfo(skb)->nr_frags, per Eric Dumazet. --- net/core/skbuff.c | 3 +++

Re: [PATCH net-next resubmit] skbuff: optimize the pull_pages code in __pskb_pull_tail()

2017-07-17 Thread lin zhang
2017-07-17 15:32 GMT+08:00 Eric Dumazet <eric.duma...@gmail.com>: > On Mon, 2017-07-17 at 10:22 +0800, Lin Zhang wrote: >> In the pull_pages code block, if the first frag size > eat, >> we can end the loop in advance to avoid extra copy. >> >> Signed-off-

[PATCH net-next resubmit] skbuff: optimize the pull_pages code in __pskb_pull_tail()

2017-07-16 Thread Lin Zhang
In the pull_pages code block, if the first frag size > eat, we can end the loop in advance to avoid extra copy. Signed-off-by: Lin Zhang <xiaolou4...@gmail.com> --- net/core/skbuff.c | 4 1 file changed, 4 insertions(+) diff --git a/net/core/skbuff.c b/net/core/skbuff.c inde

Re: [PATCH net-next] skbuff: optimize the pull_pages code in __pskb_pull_tail()

2017-07-06 Thread lin zhang
2017-07-06 17:23 GMT+08:00 Eric Dumazet <eric.duma...@gmail.com>: > On Thu, 2017-07-06 at 02:16 -0700, Eric Dumazet wrote: >> On Thu, 2017-07-06 at 17:01 +0800, Lin Zhang wrote: >> > In the pull_pages code block, if the first frags size > eat, >> > we can en

[PATCH net-next] skbuff: optimize the pull_pages code in __pskb_pull_tail()

2017-07-06 Thread Lin Zhang
In the pull_pages code block, if the first frags size > eat, we can end the loop in advance to avoid extra copy. Signed-off-by: Lin Zhang <xiaolou4...@gmail.com> --- net/core/skbuff.c | 4 1 file changed, 4 insertions(+) diff --git a/net/core/skbuff.c b/net/core/skbuff.c inde

[PATCH net-next] netfilter: conntrack: add a new NF_CT_EXT_EXPAND extension

2017-06-26 Thread Lin Zhang
if kernel support NF_CT_EXT_EXPAND extension, user could call nf_ct_expand_area_add() to register a new expansion but not need to predefine an id in enum nf_ct_ext_id. Signed-off-by: Lin Zhang <xiaolou4...@gmail.com> --- include/net/netfilter/nf_conntrack_expand.h | 26 ++ include/net/net

[PATCH] net: llc: add lock_sock in llc_ui_bind to avoid a race condition

2017-05-25 Thread Lin Zhang
. Signed-off-by: Lin Zhang <xiaolou4...@gmail.com> --- net/llc/af_llc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c index 8364fe5..c38d16f 100644 --- a/net/llc/af_llc.c +++ b/net/llc/af_llc.c @@ -311,6 +311,8 @@ static int llc_ui_bind(struct

[PATCH net v2 2/2] net: ieee802154: fix net_device reference release too early

2017-05-22 Thread Lin Zhang
_queue_xmit. I think the latest kernel is have the same problem and that dev_put should be behind of the dev_queue_xmit. Signed-off-by: Lin Zhang <xiaolou4...@gmail.com> Acked-by: Stefan Schmidt <ste...@osg.samsung.com> --- changelog: v1 -> v2: * split v1 into two patches,

[PATCH net v2 1/2] net: ieee802154: remove explicit set skb->sk

2017-05-22 Thread Lin Zhang
Explicit set skb->sk is needless, sock_alloc_send_skb is already set it. Signed-off-by: Lin Zhang <xiaolou4...@gmail.com> Acked-by: Stefan Schmidt <ste...@osg.samsung.com> --- changelog: v1 -> v2: * split v1 into two patches, per Stefan Schmidt. Thanks to Stefan Sch