2
#include <sys/socket.h>
4
#include <netinet/in.h>
5
#include <linux/ax25.h>
7
#include "maps.h" // page_rand
11
void ax25_gen_sockaddr(unsigned long *addr, unsigned long *addrlen)
13
struct sockaddr_ax25 *ax25;
15
ax25 = malloc(sizeof(struct sockaddr_ax25));
19
ax25->sax25_family = PF_AX25;
20
memcpy(ax25->sax25_call.ax25_call, page_rand, 7);
21
ax25->sax25_ndigis = rand();
22
*addr = (unsigned long) ax25;
23
*addrlen = sizeof(struct sockaddr_ax25);
26
#define NR_AX25_PROTOS 13
27
static int ax25_protocols[NR_AX25_PROTOS] = {
29
0x06, /* Compressed TCP/IP packet *//* Van Jacobsen (RFC 1144) */
30
0x07, /* Uncompressed TCP/IP packet *//* Van Jacobsen (RFC 1144) */
31
0x08, /* Segmentation fragment */
32
0xc3, /* TEXTNET datagram protocol */
33
0xc4, /* Link Quality Protocol */
35
0xcb, /* Appletalk ARP */
36
0xcc, /* ARPA Internet Protocol */
37
0xcd, /* ARPA Address Resolution */
40
0xF0 /* No layer 3 protocol impl. */
43
void ax25_rand_socket(struct socket_triplet *st)
46
case 0: st->type = SOCK_DGRAM;
49
case 1: st->type = SOCK_SEQPACKET;
50
st->protocol = ax25_protocols[rand() % NR_AX25_PROTOS];
52
case 2: st->type = SOCK_RAW;