Code:
# cd /usr/ports/net-mgmt/nagios
# make patch
<this will fetch the source, extract it, and patch it with any FreeBSD-specific patches)
# cd work/nagios-<version>/path/to/tcpip.cc
# ee tcpip.cc
<make changes as listed in the patch file>
# cd /usr/ports/net-mgmt/nagios
# make build
<make sure there are no errors in the build>
# pkg_delete -xi nagios
# make install