Solved

Reading the packet information through libipq

Posted on 2003-12-03
1
344 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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
Boot Linux vm into a menu system 2 102
Problem to command 8 103
improve Shell script 5 158
php session folder question (Code Igniter) 3 111
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

752 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