[openib-general] Re: [PATCH] SDP: In do_link_path_lookup, make sure device is IPoIB hardware type

Hal Rosenstock halr at voltaire.com
Tue Sep 27 05:11:45 PDT 2005


On Tue, 2005-09-27 at 07:59, Michael S. Tsirkin wrote:
> Quoting r. Hal Rosenstock <halr at voltaire.com>:
> > Subject: Re: [PATCH] SDP: In do_link_path_lookup, make sure device is IPoIB hardware type
> > 
> > On Tue, 2005-09-27 at 07:35, Michael S. Tsirkin wrote:
> > > Quoting r. Hal Rosenstock <halr at voltaire.com>:
> > > > Subject: [PATCH] SDP: In do_link_path_lookup, make sure device is
> > IPoIB hardware type
> > > > 
> > > > In do_link_path_lookup, make sure device selected is IPoIB hardware
> > > > type before accessing its local private data
> > > 
> > > 
> > > Hal, does this fix some actual problem you are seeing?
> > 
> > Yes, I saw it with AT. It has the same exact code in terms of this.
> > Try an ethernet IP address as a destination and see what happens.
> > 
> > > sdp_link.c has
> > > 
> > >         if (rt->u.dst.neighbour->dev->type != ARPHRD_INFINIBAND &&
> > >             !(rt->u.dst.neighbour->dev->flags & IFF_LOOPBACK)) {
> > >                 result = -ENETUNREACH;
> > >                 goto error;
> > >         }
> > > 
> > > and this seems to check the device type.
> > 
> > but that's before the device might be changed.
> > 
> > -- Hal
> > 
> 
> Hmm, I see the problem. So the fix is just to move it later:
> I think the right thing to do is to error out on non-ipoib non-loopback device.
> Something like the following (untested).

Yes, that looks right except for the comment (no more extra handling)

> +	/*
> +	 * check for IB device or loopback, the later requires extra
> +	 * handling.
> +	 */
> +	if (dev->type != ARPHRD_INFINIBAND && !(dev->flags & IFF_LOOPBACK)) {
> +		result = -ENETUNREACH;
> +		goto error;
> +	}

-- Hal




More information about the general mailing list