Solved

Reading the packet information through libipq

Posted on 2003-12-03
1
309 Views
Last Modified: 2011-09-20


  Hi !

I was running the sample code given in the manpage of libipq
Except for the inclusion os stdlib.h for exit() and the removal of formal parameters from main i have made no modifications..............the program worked well............

   But then when i wanted it to print the hardware address,
             printf("%s", m->hw_addr) ; it prints a nothing.........

 similarly with other packet information members of the structure :
ipq_packet_msg-t  i.e.,
 printf("%l", m->timestamp_sec);

except :
     m->packet_id and m->data_len was being printed with some values.............

i believe it is because the kernel had entered these information on its own...the rest of the members have to have values from the packet itself...................
   Is my printf format wrong......what may be the reason that these structure member values are null for me............






 
0
Comment
Question by:Anu_Suthakaran
1 Comment
 
LVL 3

Accepted Solution

by:
scn earned 100 total points
Comment Utility
hw_addr and hw_addrlen apply to the incoming network interface. So, it will be set only if your packet comes from another host.
hw_addr isn't a string but an array of bytes: loop for hw_addrlen iterations and print a byte at each iter.
timestamp_sec is of type int64_t, being 'long long' so printf with format "%lld"
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Debian 3.16.7 3 123
install command in linux 1 43
can't run or update 'yum' on CentOS 7 7 53
Set-Top-Box hardware and Open Source! 8 86
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now