Diffstat (limited to 'noncore/net/networksetup/TODO') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/networksetup/TODO | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/noncore/net/networksetup/TODO b/noncore/net/networksetup/TODO index 020339f..862d681 100644 --- a/noncore/net/networksetup/TODO +++ b/noncore/net/networksetup/TODO | |||
@@ -14 +14,59 @@ WLAN - add possiblity to input text or hex without knowing "s:" | |||
14 | Interface setupimp needs to use kernel calls. | 14 | Interface setupimp needs to use kernel calls. |
15 | |||
16 | Automaticly update the main list of interfaces: | ||
17 | > That would be me. :-D netlink, can you point me in the right | ||
18 | > direction where I can get more info on it? (I figured there was some | ||
19 | > kenel call) | ||
20 | |||
21 | You can look up the meaning of the packets you receive, or you can just go | ||
22 | poll for changes you might be interested in each time you receive _any_ | ||
23 | packet. Anything's better than periodic polling. | ||
24 | |||
25 | Note that you can't do this as non-root on some kernels. There's a patch | ||
26 | which can go into the hh.org kernel if it's not already there. | ||
27 | cf. http://marc.theaimsgroup.com/?l=linux-kernel&m=103520821605353&w=2 | ||
28 | |||
29 | |||
30 | #include <asm/types.h> | ||
31 | #include <sys/socket.h> | ||
32 | #include <linux/netlink.h> | ||
33 | #include <linux/rtnetlink.h> | ||
34 | |||
35 | int main(int argc, char **argv) | ||
36 | { | ||
37 | int fd; | ||
38 | unsigned char buf[4096]; | ||
39 | int ret; | ||
40 | int i, j; | ||
41 | struct sockaddr_nl snl; | ||
42 | |||
43 | fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE); | ||
44 | if (fd < 0) { | ||
45 | perror("socket"); | ||
46 | exit(1); | ||
47 | } | ||
48 | |||
49 | snl.nl_family = AF_NETLINK; | ||
50 | snl.nl_pad = 0; | ||
51 | snl.nl_pid = getpid(); | ||
52 | snl.nl_groups = RTM_NEWLINK|RTM_DELLINK; | ||
53 | |||
54 | if (bind(fd, &snl, sizeof(snl)) < 0) { | ||
55 | perror("bind"); | ||
56 | exit(1); | ||
57 | } | ||
58 | while (1) { | ||
59 | ret = recv(fd, buf, 4096, 0); | ||
60 | if (ret < 0) { | ||
61 | perror("recv"); | ||
62 | exit(1); | ||
63 | } | ||
64 | for (i=0; i<ret; i++) { | ||
65 | printf("%02x ", buf[i]); | ||
66 | } | ||
67 | printf("\n"); | ||
68 | } | ||
69 | |||
70 | } | ||
71 | -- | ||
72 | |||