[ovs-dev] [netlink v4 50/52] datapath: Convert ODP_VPORT_* to use AF_NETLINK socket layer.
Ben Pfaff
blp at nicira.com
Wed Jan 26 05:41:00 UTC 2011
On Tue, Jan 25, 2011 at 07:14:25PM -0800, Jesse Gross wrote:
> On Tue, Jan 11, 2011 at 9:50 PM, Ben Pfaff <blp at nicira.com> wrote:
> > diff --git a/datapath/datapath.c b/datapath/datapath.c
> > index 5d4e1f2..c833a3d 100644
> > --- a/datapath/datapath.c
> > +++ b/datapath/datapath.c
> > -static int get_vport(struct odp_vport __user *uodp_vport)
> > +static int odppc_get(struct sk_buff *skb, struct genl_info *info)
> > ?{
> > - ? ? ? struct nlattr *a[ODPPT_MAX + 1];
> > - ? ? ? struct odp_vport *odp_vport;
> > + ? ? ? struct nlattr **a = info->attrs;
> > + ? ? ? struct odp_vport *odp_vport = info->userhdr;
> > + ? ? ? struct sk_buff *reply;
> > ? ? ? ?struct vport *vport;
> > - ? ? ? struct sk_buff *skb;
> > ? ? ? ?int err;
> >
> > - ? ? ? skb = copy_vport_from_user(uodp_vport, a);
> > - ? ? ? err = PTR_ERR(skb);
> > - ? ? ? if (IS_ERR(skb))
> > - ? ? ? ? ? ? ? goto exit;
> > - ? ? ? odp_vport = (struct odp_vport *)skb->data;
> > -
> > ? ? ? ?mutex_lock(&dp_mutex);
> > ? ? ? ?vport = lookup_vport(odp_vport, a);
>
> I think we need to call odp_vport_cmd_validate() first.
OK, fixed.
> I also see two instances of -EINVAL being returned if the port number
> exceeds DP_MAX_PORTS instead of -EFBIG.
I only saw one, but I fixed it.
We might get upstream pushback about that. Andrew Morton habitually
criticizes misusing error numbers. EFBIG is documented as "File too
big; the size of a file would be larger than allowed by the system." and
we're certainly misusing it for that purpose.
> Otherwise, there are the similar issues from the previous patches that
> I believe you are already working on:
> * Multicast notifications on port change
> * Unused multicast group field in dp_genl_families list
> * Combining fixed headers for different families.
Yeah, that's a good summary, except that the first two items are the
same thing, I think.
More information about the dev
mailing list