On Sunday 24 October 2004 05:51 am, Thanh Tra LUU wrote: > hi, > > I try to answer as i know. > > > Yes another fight in my netlink saga. Thanks to all who have replied > > before > > > and I have learned alot from the rfc's and zebra/iproute and have > > contructed > > > a much more robust implementation. I have sent the kernel a message > > defined > > > as below. However I have not learned what exactly I should be expecting > > from > > > the kernel. That is, my message gets a reply from the kernel about eth0, > > however on my machine i have eth0,1,2,ppp0 and I would like information > > about > > > them all. I have NLM_F_ROOT set on the packet as I was under the > > impression > > > that this would dump information about all the interfaces. I have also > > tried > > > incrementing msg.info.ifi_index to 0,1,2,3 etc. No matter what these > > values > > > I always recieve this output form my program. > > > > #./nl_test_prog > > Found device: eth0 - 1 > > Found address: <--(Dont care about blank yet, main problem is > > only > > > 1 if shows. This is minor) > > > > -Am I wrong to expect the kernel to send me data about all the > > interfaces? -Am I calling this wrong? > > -What can I do to query all the interfaces? > > i've checked your code, it's all right. if you want to receive the > information of all interfaces, you should use the rtgenmsg as follows: > > struct { > struct nlmsghdr nlh; > struct rtgenmsg r; > } req; > > and then you fill the nlh as you did and set req.r.rtgen_family=AF_UNSPEC. I tried this and it produced the same output. :( > Otherwise, you can send msg to receive the information concerning each > interface that you know the interface name or index as you did. But when I tried specifying different indexes, all the way up to 32 even, it still printed out information for eth0. And how would I send a packet requesting "eth0"? I only see a place in the info struct specify the index and not any strings. > > IMHO, to know exactly the address of the hardware, you can determine the > length of the address by using : > case IFLA_ADDRESS: len=RTA_PAYLOAD(rta); // don't try to printf all the > string that you dont know where it ends. I am posting to LKML and seeing if anything comes of it. I am sure I am just missing some little thing. Perhaps if I can't figure it out I will post my full code again. (Much revised since first post in this thread) Thank you for your help. ---------------------------------------- EB > All is fine except that I can reliably "oops" it simply by trying to read > from /proc/apm (e.g. cat /proc/apm). > oops output and ksymoops-2.3.4 output is attached. > Is there anything else I can contribute? The latitude and longtitude of the bios writers current position, and a ballistic missile. --Alan Cox LKML-December 08,2000 ---------------------------------------- - : send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html