net/ieee802154: Make FC/Seq validation function public

There will be place where validating only this part of the frame will be
necessary. This will avoid to run the little bit heavier
ieee802154_validate_frame().

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2017-06-16 08:22:47 +01:00 committed by Jukka Rissanen
parent 036dde2201
commit cf78219318
2 changed files with 8 additions and 4 deletions

View file

@ -38,8 +38,7 @@ const u8_t level_2_tag_size[4] = {
};
#endif
static inline struct ieee802154_fcf_seq *
validate_fc_seq(u8_t *buf, u8_t **p_buf)
struct ieee802154_fcf_seq *ieee802154_validate_fc_seq(u8_t *buf, u8_t **p_buf)
{
struct ieee802154_fcf_seq *fs = (struct ieee802154_fcf_seq *)buf;
@ -81,7 +80,10 @@ validate_fc_seq(u8_t *buf, u8_t **p_buf)
return NULL;
}
#endif
*p_buf = buf + 3;
if (p_buf) {
*p_buf = buf + 3;
}
return fs;
}
@ -378,7 +380,7 @@ bool ieee802154_validate_frame(u8_t *buf, u8_t length,
return false;
}
mpdu->mhr.fs = validate_fc_seq(buf, &p_buf);
mpdu->mhr.fs = ieee802154_validate_fc_seq(buf, &p_buf);
if (!mpdu->mhr.fs) {
return false;
}

View file

@ -453,6 +453,8 @@ struct ieee802154_aux_security_hdr *
ieee802154_validate_aux_security_hdr(u8_t *buf, u8_t **p_buf);
#endif
struct ieee802154_fcf_seq *ieee802154_validate_fc_seq(u8_t *buf, u8_t **p_buf);
bool ieee802154_validate_frame(u8_t *buf, u8_t length,
struct ieee802154_mpdu *mpdu);