Skip to contentSkip to conversation

32bit compat for rtnetlink wireless extensions?

DISCUSSION Jean Tourrilhes 2 participants 3 messages Mar 27, 2006 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 3 lines · Arnd Bergmann

I stumbled over the 'WE-20 for kernel 2.6.16' and afaict, there is no way that IW_HEADER_TYPE_POINT rtnetlink messages can work when using 32 bit user tools on a 64 bit kernel.

Please check again ;-) I agree that it's not obvious...

Quoted 9 lines

For the ioctl inteface, this gets handled using the do_wireless_ioctl function in fs/compat_ioctl.c, but we don't have a way to convert netlink data -- it is supposed to always be compatible between 32 and 64 bit.

What is the reason for having IW_HEADER_TYPE_POINT in the first place? Does that reason apply to both the ioctl and the netlink interface, or can the netlink transport for wireless commands be changed so it does not need user space pointers?

Actually, when things are passed over RtNetlink, the pointer
is removed, and the content of IW_HEADER_TYPE_POINT is moved to not leave a gap.
The actual code for the commands is a little bit complex,
especially that the buffer is "optimised". But, if you check for the comments, you will find it. Instead, you may want to check the code for the event, where I do the same, and which is easier to read.
The function is iwe_stream_add_point(), and you will find it
in include/net/iw_handler.h. Copy below...

I was toying with the idea of changing the
IW_HEADER_TYPE_POINT struct itself, but I discarded that because the amount of fixing in the driver that would require.

Quoted 1 line
	Arnd <><

Thanks for the quick review, have fun...

Jean

/*------------------------------------------------------------------*/ /*
* Wrapper to add an short Wireless Event containing a pointer to a
* stream of events.
*/
static inline char *
iwe_stream_add_point(char * stream, /* Stream of events */

		     char *	ends,		/* End of stream */
		     struct iw_event *iwe,	/* Payload length + flags */
		     char *	extra)		/* More payload */
{
	int	event_len = IW_EV_POINT_LEN + iwe->u.data.length;
	/* Check if it's possible */
	if(likely((stream + event_len) < ends)) {
		iwe->len = event_len;
		memcpy(stream, (char *) iwe, IW_EV_LCP_LEN);
		memcpy(stream + IW_EV_LCP_LEN,
		       ((char *) iwe) + IW_EV_LCP_LEN + IW_EV_POINT_OFF,
		       IW_EV_POINT_LEN - IW_EV_LCP_LEN);
		memcpy(stream + IW_EV_POINT_LEN, extra, iwe->u.data.length);
		stream += event_len;
	}
	return stream;
}
#2 lore raw

Am Monday 27 March 2006 20:42 schrieb Jean Tourrilhes:

Quoted 3 lines

        Actually, when things are passed over RtNetlink, the pointer is removed, and the content of IW_HEADER_TYPE_POINT is moved to not leave a gap.

Ah, that makes sense, thanks for the explanation.

So if the wireless ioctl interface ever got retired, that code could get simplified a lot to just pass around a flat data structure, right?

	Arnd <><
#3 lore raw
Quoted 11 lines · Arnd Bergmann

Am Monday 27 March 2006 20:42 schrieb Jean Tourrilhes:

Quoted 3 lines

        Actually, when things are passed over RtNetlink, the pointer is removed, and the content of IW_HEADER_TYPE_POINT is moved to not leave a gap.

Ah, that makes sense, thanks for the explanation.

So if the wireless ioctl interface ever got retired, that code could get simplified a lot to just pass around a flat data structure, right?

	Arnd <><

Actually, it could be removed *now*. You would just have to
fix all wireless drivers in existence. I will scratch my head to see if we could plan a smooth transition.

Jean