Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Feb 2013 23:44:47 +0000
From:      Gerald McNulty <gmnt99@gmail.com>
To:        freebsd-ipfw@freebsd.org
Subject:   Retrieving the destination port in an ipfw fwd'ed UDP packet
Message-ID:  <CAD%2B_bPw%2BgY-yhMXkivXoyH_EvVVA4B21S3unofBUAAC050phGA@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
I'm trying to get the destination port from a UDP packet that's been ipfw
fwd'ed to my code. Getting the destination IP address works fine with *
setsockopt(...,IP_RECVDSTADDR,...)* and then *recvfrom*, but there doesn't
seem to be a way to get the port.

For TCP I could just use
getsockname(2)<http://man.freebsd.org/getsockname/2>and
getpeername(2) <http://man.freebsd.org/getpeername/2>; for all the IP
address info but this only returns the locally bound address and port, not
the actual destination.

Is there an elegant way to get the destination IP port from an ipfw fwd'ed
packet?

Thanks



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAD%2B_bPw%2BgY-yhMXkivXoyH_EvVVA4B21S3unofBUAAC050phGA>