> More thorough validation of the header contents is not necessarily > hard. The following validates the address, including optional > repeaters. > > static bool ax25_validate_hard_header(const char *ll_header, > unsigned short len) > { > ax25_digi digi; > > return !ax25_addr_parse(ll_header, len, NULL, NULL, &digi, > NULL, NULL); > }
This also breaks because there is a KISS header byte on an AX.25 transmission and it is valid to send a KISS control frame via SOCK_PACKET but it cannot be generated by other protocols. Basically everything hitting an AX.25 port is either a zero byte followed by an AX.25 frame, or a KISS frame the first of which is non zero and which is used to set parameters on the radio side. The AX.25 device level drivers are simply written to be robust if thrown partial frames. The other thing that concerns me about this added logic in general is that you are also breaking test tools that want to deliberately send corrupt frames to certain classes of interface. I'm not sure how big an issue that is given we always for example padded ethernet frames properly, but the more validation we do for a privileged interface the more we prevent applications for testing network behaviour from being able to run on Linux. Possibly there should be a CAP_SYS_RAWIO test but making it impossible is a bad step. Alan