Solved

Reading the packet information through libipq

Posted on 2003-12-03
1
339 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Debian 3.16.7 3 153
running two linux commands sequentially in background 16 52
CRON expression that fires every other Tuesday 3 126
mounting drive a in a linux 14 36
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

749 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