Message ID | 20180713125445.4612-3-pablo@netfilter.org |
---|---|
State | Accepted |
Delegated to: | Pablo Neira |
Headers | show |
Series | None | expand |
Hi Pablo, I love your patch! Perhaps something to improve: [auto build test WARNING on nf-next/master] url: https://github.com/0day-ci/linux/commits/Pablo-Neira-Ayuso/netfilter-nf_osf-add-nf_osf_match_one/20180714-051307 base: https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master reproduce: # apt-get install sparse make ARCH=x86_64 allmodconfig make C=1 CF=-D__CHECK_ENDIAN__ sparse warnings: (new ones prefixed by >>) >> net/netfilter/nf_osf.c:267:24: sparse: Using plain integer as NULL pointer vim +267 net/netfilter/nf_osf.c 251 252 const char *nf_osf_find(const struct sk_buff *skb, 253 const struct list_head *nf_osf_fingers) 254 { 255 const struct iphdr *ip = ip_hdr(skb); 256 const struct nf_osf_user_finger *f; 257 unsigned char opts[MAX_IPOPTLEN]; 258 const struct nf_osf_finger *kf; 259 struct nf_osf_hdr_ctx ctx; 260 const struct tcphdr *tcp; 261 const char *genre = NULL; 262 263 memset(&ctx, 0, sizeof(ctx)); 264 265 tcp = nf_osf_hdr_ctx_init(&ctx, skb, ip, opts); 266 if (!tcp) > 267 return false; 268 269 list_for_each_entry_rcu(kf, &nf_osf_fingers[ctx.df], finger_entry) { 270 f = &kf->finger; 271 if (!nf_osf_match_one(skb, f, -1, &ctx)) 272 continue; 273 274 genre = f->genre; 275 break; 276 } 277 278 return genre; 279 } 280 EXPORT_SYMBOL_GPL(nf_osf_find); 281 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Tested-by: Fernando Fernandez Mancera <ffmancera@riseup.net> On 07/13/2018 02:54 PM, Pablo Neira Ayuso wrote: > This new function returns the OS genre as a string. Plan is to use to > from the new nft_osf extension. > > Note that this doesn't yet support ttl options, but it could be easily > extended to do so. > > Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> > --- > Compile tested only. > > include/linux/netfilter/nf_osf.h | 3 +++ > net/netfilter/nf_osf.c | 30 ++++++++++++++++++++++++++++++ > 2 files changed, 33 insertions(+) > > diff --git a/include/linux/netfilter/nf_osf.h b/include/linux/netfilter/nf_osf.h > index 0e114c492fb8..7d0947d6ef16 100644 > --- a/include/linux/netfilter/nf_osf.h > +++ b/include/linux/netfilter/nf_osf.h > @@ -31,3 +31,6 @@ bool nf_osf_match(const struct sk_buff *skb, u_int8_t family, > int hooknum, struct net_device *in, struct net_device *out, > const struct nf_osf_info *info, struct net *net, > const struct list_head *nf_osf_fingers); > + > +const char *nf_osf_find(const struct sk_buff *skb, > + const struct list_head *nf_osf_fingers); > diff --git a/net/netfilter/nf_osf.c b/net/netfilter/nf_osf.c > index b44d62d5d9a9..f4c75e982902 100644 > --- a/net/netfilter/nf_osf.c > +++ b/net/netfilter/nf_osf.c > @@ -249,4 +249,34 @@ nf_osf_match(const struct sk_buff *skb, u_int8_t family, > } > EXPORT_SYMBOL_GPL(nf_osf_match); > > +const char *nf_osf_find(const struct sk_buff *skb, > + const struct list_head *nf_osf_fingers) > +{ > + const struct iphdr *ip = ip_hdr(skb); > + const struct nf_osf_user_finger *f; > + unsigned char opts[MAX_IPOPTLEN]; > + const struct nf_osf_finger *kf; > + struct nf_osf_hdr_ctx ctx; > + const struct tcphdr *tcp; > + const char *genre = NULL; > + > + memset(&ctx, 0, sizeof(ctx)); > + > + tcp = nf_osf_hdr_ctx_init(&ctx, skb, ip, opts); > + if (!tcp) > + return false; > + > + list_for_each_entry_rcu(kf, &nf_osf_fingers[ctx.df], finger_entry) { > + f = &kf->finger; > + if (!nf_osf_match_one(skb, f, -1, &ctx)) > + continue; > + > + genre = f->genre; > + break; > + } > + > + return genre; > +} > +EXPORT_SYMBOL_GPL(nf_osf_find); > + > MODULE_LICENSE("GPL"); > -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/include/linux/netfilter/nf_osf.h b/include/linux/netfilter/nf_osf.h index 0e114c492fb8..7d0947d6ef16 100644 --- a/include/linux/netfilter/nf_osf.h +++ b/include/linux/netfilter/nf_osf.h @@ -31,3 +31,6 @@ bool nf_osf_match(const struct sk_buff *skb, u_int8_t family, int hooknum, struct net_device *in, struct net_device *out, const struct nf_osf_info *info, struct net *net, const struct list_head *nf_osf_fingers); + +const char *nf_osf_find(const struct sk_buff *skb, + const struct list_head *nf_osf_fingers); diff --git a/net/netfilter/nf_osf.c b/net/netfilter/nf_osf.c index b44d62d5d9a9..f4c75e982902 100644 --- a/net/netfilter/nf_osf.c +++ b/net/netfilter/nf_osf.c @@ -249,4 +249,34 @@ nf_osf_match(const struct sk_buff *skb, u_int8_t family, } EXPORT_SYMBOL_GPL(nf_osf_match); +const char *nf_osf_find(const struct sk_buff *skb, + const struct list_head *nf_osf_fingers) +{ + const struct iphdr *ip = ip_hdr(skb); + const struct nf_osf_user_finger *f; + unsigned char opts[MAX_IPOPTLEN]; + const struct nf_osf_finger *kf; + struct nf_osf_hdr_ctx ctx; + const struct tcphdr *tcp; + const char *genre = NULL; + + memset(&ctx, 0, sizeof(ctx)); + + tcp = nf_osf_hdr_ctx_init(&ctx, skb, ip, opts); + if (!tcp) + return false; + + list_for_each_entry_rcu(kf, &nf_osf_fingers[ctx.df], finger_entry) { + f = &kf->finger; + if (!nf_osf_match_one(skb, f, -1, &ctx)) + continue; + + genre = f->genre; + break; + } + + return genre; +} +EXPORT_SYMBOL_GPL(nf_osf_find); + MODULE_LICENSE("GPL");
This new function returns the OS genre as a string. Plan is to use to from the new nft_osf extension. Note that this doesn't yet support ttl options, but it could be easily extended to do so. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> --- Compile tested only. include/linux/netfilter/nf_osf.h | 3 +++ net/netfilter/nf_osf.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+)