diff --git a/constants.h b/constants.h index dcaf9fb8..486b5d48 100644 --- a/constants.h +++ b/constants.h @@ -77,6 +77,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define OVERLAY_MAX_LOCAL_IDENTITIES 256 +/* All of these types should be considered deprecated. Processing code should migrate to well known MDP port numbers */ /* Overlay mesh packet codes */ #define OF_TYPE_SELFANNOUNCE 0x10 /* BATMAN style announcement frames */ #define OF_TYPE_SELFANNOUNCE_ACK 0x20 /* BATMAN style "I saw your announcment" frames */ @@ -98,6 +99,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define PAYLOAD_FLAG_CIPHERED (1<<4) #define PAYLOAD_FLAG_SIGNED (1<<5) +// this can be removed once all overlay messages have been turned into mdp payloads +#define PAYLOAD_FLAG_LEGACY_TYPE (1<<7) + /* Crypto/security options */ #define OF_CRYPTO_NONE 0x00 #define OF_CRYPTO_CIPHERED PAYLOAD_FLAG_CIPHERED /* Encrypted frame */ diff --git a/overlay_packetformats.c b/overlay_packetformats.c index 7ea2cb2b..d37a0e81 100644 --- a/overlay_packetformats.c +++ b/overlay_packetformats.c @@ -265,9 +265,13 @@ int packetOkOverlay(struct overlay_interface *interface,unsigned char *packet, s f.ttl--; if (f.ttl<=0) forward=0; - f.type=ob_get(b); - if (f.type<0) - break; + + if (flags & PAYLOAD_FLAG_LEGACY_TYPE){ + f.type=ob_get(b); + if (f.type<0) + break; + }else + f.type=OF_TYPE_DATA; f.modifiers=flags; diff --git a/overlay_payload.c b/overlay_payload.c index 274c833f..f6f05816 100644 --- a/overlay_payload.c +++ b/overlay_payload.c @@ -40,6 +40,9 @@ int overlay_frame_build_header(struct decode_context *context, struct overlay_bu if (!destination) flags |= PAYLOAD_FLAG_TO_BROADCAST; + if (type!=OF_TYPE_DATA) + flags |= PAYLOAD_FLAG_LEGACY_TYPE; + if (ob_append_byte(buff, flags)) return -1; if (!(flags & PAYLOAD_FLAG_SENDER_SAME)){ @@ -60,7 +63,10 @@ int overlay_frame_build_header(struct decode_context *context, struct overlay_bu if (!(flags & PAYLOAD_FLAG_ONE_HOP)){ if (ob_append_byte(buff, ttl | ((queue&3)<<5))) return -1; } - if (ob_append_byte(buff, type)) return -1; + + if (flags & PAYLOAD_FLAG_LEGACY_TYPE){ + if (ob_append_byte(buff, type)) return -1; + } if (ob_append_rfs(buff, 2)) return -1;