summaryrefslogtreecommitdiffstats
path: root/lib/libalias/alias_proxy.c
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2004-07-06 12:13:28 +0000
committerdes <des@FreeBSD.org>2004-07-06 12:13:28 +0000
commit93180ebf2d291b1bba586c96cddb79d028f53e29 (patch)
tree26f30e4465d6cc4e19885a8912879ee00b6630f9 /lib/libalias/alias_proxy.c
parent858232d10a73b399e1b8a7eedd3dc58a225442a6 (diff)
downloadFreeBSD-src-93180ebf2d291b1bba586c96cddb79d028f53e29.zip
FreeBSD-src-93180ebf2d291b1bba586c96cddb79d028f53e29.tar.gz
Introduce inline {ip,udp,tcp}_next() functions which take a pointer to an
{ip,udp,tcp} header and return a void * pointing to the payload (i.e. the first byte past the end of the header and any required padding). Use them consistently throughout libalias to a) reduce code duplication, b) improve code legibility, c) get rid of a bunch of alignment warnings.
Diffstat (limited to 'lib/libalias/alias_proxy.c')
-rw-r--r--lib/libalias/alias_proxy.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libalias/alias_proxy.c b/lib/libalias/alias_proxy.c
index 24d8bfee7..e0e1c05 100644
--- a/lib/libalias/alias_proxy.c
+++ b/lib/libalias/alias_proxy.c
@@ -283,7 +283,7 @@ ProxyEncodeTcpStream(struct alias_link *lnk,
struct tcphdr *tc;
/* Compute pointer to tcp header */
- tc = (struct tcphdr *)((char *)pip + (pip->ip_hl << 2));
+ tc = (struct tcphdr *)ip_next(pip);
/* Don't modify if once already modified */
@@ -392,7 +392,7 @@ ProxyEncodeIpHeader(struct ip *pip,
memcpy(&option[2], (u_char *) & pip->ip_dst, 4);
- tc = (struct tcphdr *)((char *)pip + (pip->ip_hl << 2));
+ tc = (struct tcphdr *)ip_next(pip);
memcpy(&option[6], (u_char *) & tc->th_sport, 2);
memcpy(ptr, option, 8);
@@ -451,7 +451,7 @@ ProxyCheck(struct libalias *la, struct ip *pip,
src_addr = pip->ip_src;
dst_addr = pip->ip_dst;
- dst_port = ((struct tcphdr *)((char *)pip + (pip->ip_hl << 2)))
+ dst_port = ((struct tcphdr *)ip_next(pip))
->th_dport;
ptr = la->proxyList;
OpenPOWER on IntegriCloud