summaryrefslogtreecommitdiffstats
path: root/sys/netinet/libalias/alias_nbt.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_nbt.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_nbt.c')
-rw-r--r--sys/netinet/libalias/alias_nbt.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/netinet/libalias/alias_nbt.c b/sys/netinet/libalias/alias_nbt.c
index 151bc9d..b51abd1 100644
--- a/sys/netinet/libalias/alias_nbt.c
+++ b/sys/netinet/libalias/alias_nbt.c
@@ -218,10 +218,10 @@ AliasHandleUdpNbt(
(void)lnk;
/* Calculate data length of UDP packet */
- uh = (struct udphdr *)((char *)pip + (pip->ip_hl << 2));
+ uh = (struct udphdr *)ip_next(pip);
pmax = (char *)uh + ntohs(uh->uh_ulen);
- ndh = (NbtDataHeader *) ((char *)uh + (sizeof(struct udphdr)));
+ ndh = (NbtDataHeader *)udp_next(uh);
if ((char *)(ndh + 1) > pmax)
return (-1);
#ifdef DEBUG
@@ -654,9 +654,9 @@ AliasHandleUdpNbtNS(
nbtarg.newport = *original_port;
/* Calculate data length of UDP packet */
- uh = (struct udphdr *)((char *)pip + (pip->ip_hl << 2));
+ uh = (struct udphdr *)ip_next(pip);
nbtarg.uh_sum = &(uh->uh_sum);
- nsh = (NbtNSHeader *) ((char *)uh + (sizeof(struct udphdr)));
+ nsh = (NbtNSHeader *)udp_next(uh);
p = (u_char *) (nsh + 1);
pmax = (char *)uh + ntohs(uh->uh_ulen);
OpenPOWER on IntegriCloud