summaryrefslogtreecommitdiffstats
path: root/sys/netinet/libalias/alias_smedia.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 /sys/netinet/libalias/alias_smedia.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 'sys/netinet/libalias/alias_smedia.c')
-rw-r--r--sys/netinet/libalias/alias_smedia.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/netinet/libalias/alias_smedia.c b/sys/netinet/libalias/alias_smedia.c
index ef19bea..888937c 100644
--- a/sys/netinet/libalias/alias_smedia.c
+++ b/sys/netinet/libalias/alias_smedia.c
@@ -155,7 +155,7 @@ alias_rtsp_out(struct libalias *la, struct ip *pip,
struct in_addr null_addr;
/* Calculate data length of TCP packet */
- tc = (struct tcphdr *)((char *)pip + (pip->ip_hl << 2));
+ tc = (struct tcphdr *)ip_next(pip);
hlen = (pip->ip_hl + tc->th_off) << 2;
tlen = ntohs(pip->ip_len);
dlen = tlen - hlen;
@@ -359,7 +359,7 @@ alias_pna_out(struct libalias *la, struct ip *pip,
/* Punch hole in firewall */
PunchFWHole(pna_links);
#endif
- tc = (struct tcphdr *)((char *)pip + (pip->ip_hl << 2));
+ tc = (struct tcphdr *)ip_next(pip);
alias_port = GetAliasPort(pna_links);
memcpy(work, &alias_port, 2);
@@ -387,7 +387,7 @@ AliasHandleRtspOut(struct libalias *la, struct ip *pip, struct alias_link *lnk,
(void)maxpacketsize;
- tc = (struct tcphdr *)((char *)pip + (pip->ip_hl << 2));
+ tc = (struct tcphdr *)ip_next(pip);
hlen = (pip->ip_hl + tc->th_off) << 2;
tlen = ntohs(pip->ip_len);
dlen = tlen - hlen;
OpenPOWER on IntegriCloud