Skip to contentSkip to conversation

python nl80211 code

DISCUSSION Kalle Valo 2 participants 7 messages Dec 1, 2009

lore
Share & tools
lore

Kalle Valo

author
#0 lore raw

Hello,

I want to run some tests through nl80211 and, as usual, I prefer to use python for that. Are there any scripts/examples using nl80211 with python available? Preferably with an open enough license.

Signature · 1 line
Kalle Valo
#1 lore raw
Quoted 5 lines · Kalle Valo

Hello,

I want to run some tests through nl80211 and, as usual, I prefer to use python for that. Are there any scripts/examples using nl80211 with python available? Preferably with an open enough license.

http://git.sipsolutions.net/pynl80211.git/

Doesn't have much of a license but was intended to be GPLv2, but there was only one commit from somebody other than me who'd probably relicense if needed.

johannes

author
#2 lore raw
Quoted 8 lines · Johannes Berg
Quoted 5 lines · Kalle Valo

Hello,

I want to run some tests through nl80211 and, as usual, I prefer to use python for that. Are there any scripts/examples using nl80211 with python available? Preferably with an open enough license.

http://git.sipsolutions.net/pynl80211.git/

Thanks. This looks interesting but doesn't compile right now:

$ make
Checking netlink numbers:
check.r5cOZHc/check.c: In function 'main':
check.r5cOZHc/check.c:63: error: lvalue required as left operand of
assignment
check.r5cOZHc/check.c:78: error: 'NL80211_CHAN_MAX' undeclared (first
use in this function)
check.r5cOZHc/check.c:78: error: (Each undeclared identifier is
reported only once
check.r5cOZHc/check.c:78: error: for each function it appears in.)
check.r5cOZHc/check.c:80: error: lvalue required as left operand of
assignment
check.r5cOZHc/check.c:86: error: 'NL80211_RATE_MAX' undeclared (first
use in this function)
[...]

The parsing of nl80211 seems to fail. If I find some time, I try to look at it.

Quoted 3 lines

Doesn't have much of a license but was intended to be GPLv2, but there was only one commit from somebody other than me who'd probably relicense if needed.

That's good enough :)

Signature · 1 line
Kalle Valo
#3 lore raw
Quoted 18 lines · Kalle Valo

Thanks. This looks interesting but doesn't compile right now:

$ make
Checking netlink numbers:
check.r5cOZHc/check.c: In function 'main':
check.r5cOZHc/check.c:63: error: lvalue required as left operand of
assignment
check.r5cOZHc/check.c:78: error: 'NL80211_CHAN_MAX' undeclared (first
use in this function)
check.r5cOZHc/check.c:78: error: (Each undeclared identifier is
reported only once
check.r5cOZHc/check.c:78: error: for each function it appears in.)
check.r5cOZHc/check.c:80: error: lvalue required as left operand of
assignment
check.r5cOZHc/check.c:86: error: 'NL80211_RATE_MAX' undeclared (first
use in this function)
[...]
Quoted 2 lines

The parsing of nl80211 seems to fail. If I find some time, I try to look at it.

Oh, that's not surprising, it's over two years old and after I started writing the C tool (iw) I never maintained the comments in nl80211.h that this tried to parse.

johannes

author
#4 lore raw
Quoted 6 lines · Johannes Berg
Quoted 2 lines

The parsing of nl80211 seems to fail. If I find some time, I try to look at it.

Oh, that's not surprising, it's over two years old and after I started writing the C tool (iw) I never maintained the comments in nl80211.h that this tried to parse.

Ok, good to know. What do you think if I remove the parsing of nl80211.h and instead add the nl80211 commands manually as python code? Sure, it's monkey code but easier to maintain IMHO.

Or have some intermediate language, maybe. Any ideas?

Signature · 1 line
Kalle Valo
#5 lore raw
Quoted 5 lines · Kalle Valo
Quoted 3 lines · Johannes Berg
Quoted 2 lines

The parsing of nl80211 seems to fail. If I find some time, I try to look at it.

Quoted 7 lines
Quoted 3 lines

Oh, that's not surprising, it's over two years old and after I started writing the C tool (iw) I never maintained the comments in nl80211.h that this tried to parse.

Ok, good to know. What do you think if I remove the parsing of nl80211.h and instead add the nl80211 commands manually as python code? Sure, it's monkey code but easier to maintain IMHO.

Yeah, I agree.

Quoted 1 line

Or have some intermediate language, maybe. Any ideas?

I guess we could use sparse to output introspection information for nl80211.h instead, but is it worth it?

johannes

author
#6 lore raw
Quoted 5 lines · Johannes Berg
Quoted 3 lines

Ok, good to know. What do you think if I remove the parsing of nl80211.h and instead add the nl80211 commands manually as python code? Sure, it's monkey code but easier to maintain IMHO.

Yeah, I agree.

Good. I'll do that then.

Quoted 4 lines
Quoted 1 line

Or have some intermediate language, maybe. Any ideas?

I guess we could use sparse to output introspection information for nl80211.h instead, but is it worth it?

Increases coolness factory but that's about it =)

Signature · 1 line
Kalle Valo