Do not assume that you're on a big-endian processor that can dereference
unaligned pointers - all the world's not a m68k. :-) Most of the world
is little-endian these days by CPU count (especially on personal
computers), and one of the popular big-endian processor families, SPARC,
traps when dereferencing unaligned pointers.
While we're at it, note the last I-D that described RTPv1 and the
current RFC for RTPv2.
hasopt = 0;
hasext = 0;
if ((i0 >> 30) == 1) {
hasopt = 0;
hasext = 0;
if ((i0 >> 30) == 1) {
+ /* rtp v1 - draft-ietf-avt-rtp-04 */
hasopt = i0 & 0x800000;
contype = (i0 >> 16) & 0x3f;
hasmarker = i0 & 0x400000;
ptype = "rtpv1";
} else {
hasopt = i0 & 0x800000;
contype = (i0 >> 16) & 0x3f;
hasmarker = i0 & 0x400000;
ptype = "rtpv1";
} else {
+ /* rtp v2 - RFC 3550 */
hasext = i0 & 0x10000000;
contype = (i0 >> 16) & 0x7f;
hasmarker = i0 & 0x800000;
hasext = i0 & 0x10000000;
contype = (i0 >> 16) & 0x7f;
hasmarker = i0 & 0x800000;
if (hasopt) {
u_int i2, optlen;
do {
if (hasopt) {
u_int i2, optlen;
do {
+ i2 = EXTRACT_32BITS(ip);
optlen = (i2 >> 16) & 0xff;
if (optlen == 0 || optlen > len) {
ND_PRINT((ndo, " !opt"));
optlen = (i2 >> 16) & 0xff;
if (optlen == 0 || optlen > len) {
ND_PRINT((ndo, " !opt"));
}
if (hasext) {
u_int i2, extlen;
}
if (hasext) {
u_int i2, extlen;
+ i2 = EXTRACT_32BITS(ip);
extlen = (i2 & 0xffff) + 1;
if (extlen > len) {
ND_PRINT((ndo, " !ext"));
extlen = (i2 & 0xffff) + 1;
if (extlen > len) {
ND_PRINT((ndo, " !ext"));
ip += extlen;
}
if (contype == 0x1f) /*XXX H.261 */
ip += extlen;
}
if (contype == 0x1f) /*XXX H.261 */
- ND_PRINT((ndo, " 0x%04x", ip[0] >> 16));
+ ND_PRINT((ndo, " 0x%04x", EXTRACT_32BITS(ip) >> 16));