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
1566
accept rate: 50%


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)

link

answered 23 Jul '12, 10:06

bball2601's gravatar image

bball2601
1566
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 ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×211
×72
×23

Asked: 23 Jul '12, 08:23

Seen: 1,080 times

Last updated: 23 Jul '12, 15:22

powered by OSQA