[PATCH] gtp: set NLM_F_MULTI flag in gtp_genl_dump_pdp()

Yoshiyuki Kurauchi ahochauwaaaaa at gmail.com
Mon Apr 27 10:32:10 UTC 2020


Hi,

> This should be 0 instead, not sure why using info->nlhdr->nlmsg_flags
> for this netlink GET operation.

That's just my mistake, thank you for your review.
I'll send a revised patch again later today.

BR,
Yoshiyuki

On Sun, Apr 26, 2020 at 7:29 PM Pablo Neira Ayuso <pablo at netfilter.org>
wrote:

> Hi,
>
> On Wed, Apr 22, 2020 at 11:42:11PM +0900, Yoshiyuki Kurauchi wrote:
> > In drivers/net/gtp.c, gtp_genl_dump_pdp() should set NLM_F_MULTI
> > flag since it returns multipart message.
> > This patch adds a new arg "flags" in gtp_genl_fill_info() so that
> > flags can be set by the callers.
> >
> > Signed-off-by: Yoshiyuki Kurauchi <ahochauwaaaaa at gmail.com>
> > ---
> >  drivers/net/gtp.c | 11 ++++++-----
> >  1 file changed, 6 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
> > index 672cd2caf2fb..10fa731bae6d 100644
> > --- a/drivers/net/gtp.c
> > +++ b/drivers/net/gtp.c
> > @@ -1097,7 +1097,7 @@ static int gtp_genl_new_pdp(struct sk_buff *skb,
> struct genl_info *info)
> >  }
> >
> >  static struct pdp_ctx *gtp_find_pdp_by_link(struct net *net,
> > -                                         struct nlattr *nla[])
> > +                                             struct nlattr *nla[])
> >  {
> >       struct gtp_dev *gtp;
> >
> > @@ -1169,11 +1169,11 @@ static int gtp_genl_del_pdp(struct sk_buff *skb,
> struct genl_info *info)
> >  static struct genl_family gtp_genl_family;
> >
> >  static int gtp_genl_fill_info(struct sk_buff *skb, u32 snd_portid, u32
> snd_seq,
> > -                           u32 type, struct pdp_ctx *pctx)
> > +                           int flags, u32 type, struct pdp_ctx *pctx)
> >  {
> >       void *genlh;
> >
> > -     genlh = genlmsg_put(skb, snd_portid, snd_seq, &gtp_genl_family, 0,
> > +     genlh = genlmsg_put(skb, snd_portid, snd_seq, &gtp_genl_family,
> flags,
> >                           type);
> >       if (genlh == NULL)
> >               goto nlmsg_failure;
> > @@ -1227,8 +1227,8 @@ static int gtp_genl_get_pdp(struct sk_buff *skb,
> struct genl_info *info)
> >               goto err_unlock;
> >       }
> >
> > -     err = gtp_genl_fill_info(skb2, NETLINK_CB(skb).portid,
> > -                              info->snd_seq, info->nlhdr->nlmsg_type,
> pctx);
> > +     err = gtp_genl_fill_info(skb2, NETLINK_CB(skb).portid,
> info->snd_seq,
> > +                             info->nlhdr->nlmsg_flags,
> info->nlhdr->nlmsg_type, pctx);
>
> This should be 0 instead, not sure why using info->nlhdr->nlmsg_flags
> for this netlink GET operation.
>
> >       if (err < 0)
> >               goto err_unlock_free;
> >
> > @@ -1271,6 +1271,7 @@ static int gtp_genl_dump_pdp(struct sk_buff *skb,
> >                                   gtp_genl_fill_info(skb,
> >                                           NETLINK_CB(cb->skb).portid,
> >                                           cb->nlh->nlmsg_seq,
> > +                                         NLM_F_MULTI,
>
> This one looks fine to me.
>
> >                                           cb->nlh->nlmsg_type, pctx)) {
> >                                       cb->args[0] = i;
> >                                       cb->args[1] = j;
> > --
> > 2.17.1
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/osmocom-net-gprs/attachments/20200427/a80815ea/attachment.htm>


More information about the osmocom-net-gprs mailing list