Skip to content

Commit ea47781

Browse files
wdebruijdavem330
authored andcommitted
ax25: add link layer header validation function
As variable length protocol, AX25 fails link layer header validation tests based on a minimum length. header_ops.validate allows protocols to validate headers that are shorter than hard_header_len. Implement this callback for AX25. See also http://comments.gmane.org/gmane.linux.network/401064 Signed-off-by: Willem de Bruijn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2793a23 commit ea47781

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

net/ax25/ax25_ip.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,23 @@ netdev_tx_t ax25_ip_xmit(struct sk_buff *skb)
228228
}
229229
#endif
230230

231+
static bool ax25_validate_header(const char *header, unsigned int len)
232+
{
233+
ax25_digi digi;
234+
235+
if (!len)
236+
return false;
237+
238+
if (header[0])
239+
return true;
240+
241+
return ax25_addr_parse(header + 1, len - 1, NULL, NULL, &digi, NULL,
242+
NULL);
243+
}
244+
231245
const struct header_ops ax25_header_ops = {
232246
.create = ax25_hard_header,
247+
.validate = ax25_validate_header,
233248
};
234249

235250
EXPORT_SYMBOL(ax25_header_ops);

0 commit comments

Comments
 (0)