Solved

Reading the packet information through libipq

Posted on 2003-12-03
1
333 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
ID: 9868887
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
why should double free() crash? 7 35
what is Amazon Linux AMI 6 69
linux / python expert needed 3 98
App holding yum lock unable to update my rpm package 1 72
Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

808 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