netlink messages

M

martin f krafft

Dear list,

I am writing a daemon in Python that listens on AF_NETLINK and
processes RTM_NETLINK messages. FWIW, code is below since there is
hardly any reference on the net yet.

As you can see from the code, the NETLINK message is all binary/hex.
Before I go about wrapping it in a Python class, I was wondering
whether such a class already existed or if someone is already
working on this.

Please let me know if you are or have any hints, and please keep me
on CC.

Thanks,
m


Python 2.5.1 (r251:54863, Apr 25 2007, 22:53:30)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
from socket import *
from select import *
s = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE)
from os import getpid
RTMGRP_LINK = 1
s.bind((getpid(), RTMGRP_LINK))
p = select((s,), (), (), 0)
p ([], [], [])
# connect device ...
p = select((s,), (), (), 0)
p
([ said:
s2 = p[0][0]
d = s2.recv(4096)
d
'\xf8\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x0c\x00\x00\x00\x02\x10\x00\x00\xff\xff\xff\xff\t\x00\x03\x00eth0\x00\x00\x00\x00\x08\x00\r\x00\xe8\x03\x00\x00\x08\x00\x0f\x00\x00\x00\x00\x00\x05\x00\x10\x00\x02\x00\x00\x00\x05\x00\x11\x00\x00\x00\x00\x00\x08\x00\x04\x00\xdc\x05\x00\x00\t\x00\x06\x00noop\x00\x00\x00\x00\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x00\x01\x00N\x80\xba~4\x14\x00\x00\n\x00\x02\x00\xff\xff\xff\xff\xff\xff\x00\x00`\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'


--
martin; (greetings from the heart of the sun.)
\____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck

spamtraps: (e-mail address removed)

"men always want to be a woman's first love.
women have a more subtle instinct:
what they like is to be a man's last romance."
-- oscar wilde

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFGbSWEIgvIgzMMSnURAp95AJ45+oEDXXXGckKCdKwv4t8n0up1gwCfVJ2o
sn3chcfYz2+ejJXEzYtazqE=
=wD9A
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,059
Latest member
cryptoseoagencies

Latest Threads

Top