473,221 Members | 2,215 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,221 software developers and data experts.

netlink messages

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
([<socket._socketobject object at 0xb7d9b374>], [], [])
>>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\x0 2\x10\x00\x00\xff\xff\xff\xff\t\x00\x03\x00eth0\x0 0\x00\x00\x00\x08\x00\r\x00\xe8\x03\x00\x00\x08\x0 0\x0f\x00\x00\x00\x00\x00\x05\x00\x10\x00\x02\x00\ x00\x00\x05\x00\x11\x00\x00\x00\x00\x00\x08\x00\x0 4\x00\xdc\x05\x00\x00\t\x00\x06\x00noop\x00\x00\x0 0\x00\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\ x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0 0\x00\x00\x00\x00\x00\x00\x00\n\x00\x01\x00N\x80\x ba~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\x0 0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0 0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0 0\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: ma***********@madduck.net

"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+oEDXXXGckKCdKwv4t 8n0up1gwCfVJ2o
sn3chcfYz2+ejJXEzYtazqE=
=wD9A
-----END PGP SIGNATURE-----

Jun 11 '07 #1
0 911

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: SJB | last post by:
I wanted to use python to receive some messages from the linux kernel via way of netlink sockets. However this doesn't seem to be supported from everything I have been able to find so far. Can...
0
by: piyush | last post by:
Sorry for repeated posting but I couldnt get things right/completely in the first post. I am in the process of deciding the IPC mechanisms to use for communication between 1) An application...
5
by: Adam | last post by:
Hi, How do i listen for windows messages in c# on compact.net? I have a window containing an instantiation of the HTML viewer control, which is a child of the main form. As the compact...
0
by: piyush | last post by:
Sorry for repeated posts, I couldnt get things right and complete in the previous post. I am in the process of deciding the IPC mechanisms to use for communication between 1) An application...
5
by: zorhel | last post by:
Hi. My clients will be IE, Mozilla and Opera in a Windows and *nix OS. So, my web app need to, from a server, send messages to a specific client (browser), send messages for all clients,...
0
by: neonspark | last post by:
I'm buidling some simple macro functionality for my app so the users can record a sequence of keyboard inputs and replay them reliably via some menu. Originally, I used: protected override bool...
1
by: CodeSeeker | last post by:
I have an application, which uses pop3 to read the messages from the mailbox, and it has been working fine for so many year. We recently have started changing this application to use java mail IMAP 4...
5
by: hnshashi | last post by:
I have writtem kernel(2.4) module to commu. with user space appl. using netlink socket. I am getting compilation error. kernel module:-> #include <linux/skbuff.h> #include<linux/module.h> ...
18
by: Grant Edwards | last post by:
Could whoever is responsible for the gateway that is grabbing my postings off of Usenet and e-mailing them out please fix the headers in the mail messages so that I don't get the bounce messages?...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.