This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

How to get source IP address?

1

I am making a custom dissector that needs to be able to find the source ip address of a packet and compare it with the IP address of the host computer.

How would I be able to find the source IP address?

Thanks in advance for any help.

asked 23 Jul '12, 08:23

bball2601's gravatar image

bball2601
16567
accept rate: 50%


2 Answers:

0

I just figured it out, but for anyone who is having trouble with the same type of thing, you can output your source ip address as a string with ip_to_str(pinfo->src.data)

answered 23 Jul '12, 10:06

bball2601's gravatar image

bball2601
16567
accept rate: 50%

Note that ip_to_str() assumes the source address is an IPv4 address. You might want to check the type of the address and handle IPv6 addresses as well.

(23 Jul '12, 15:22) Guy Harris ♦♦

-1

To find the Internet IP address visit the site IP-details.com here it displays the information like ISP(Internet Service Provider),IP location,country,latitude,longitude etc..

answered 04 Jun '13, 23:41

VelaiyatuPillai's gravatar image

VelaiyatuPillai
102
accept rate: 0%