clean up the remap_file_pages sanitize routine
[trinity.git] / net / tipc.c
blob105cabf88615fb46c0c517653c53c74911122f45
1 #include <sys/types.h>
2 #include <sys/socket.h>
3 #include <sys/un.h>
4 #include <netinet/in.h>
5 #include <linux/tipc.h>
6 #include <stdlib.h>
7 #include "net.h"
8 #include "random.h"
10 void tipc_gen_sockaddr(unsigned long **addr, unsigned long *addrlen)
12 struct sockaddr_tipc *tipc;
14 tipc = malloc(sizeof(struct sockaddr_tipc));
15 if (tipc == NULL)
16 return;
17 tipc->family = AF_TIPC;
18 tipc->addrtype = rand();
19 tipc->scope = rand();
20 tipc->addr.id.ref = rand();
21 tipc->addr.id.node = rand();
22 tipc->addr.nameseq.type = rand();
23 tipc->addr.nameseq.lower = rand();
24 tipc->addr.nameseq.upper = rand();
25 tipc->addr.name.name.type = rand();
26 tipc->addr.name.name.instance = rand();
27 tipc->addr.name.domain = rand();
28 *addr = (unsigned long *) tipc;
29 *addrlen = sizeof(struct sockaddr_tipc);
32 void tipc_rand_socket(struct socket_triplet *st)
34 st->protocol = 0;
36 switch (rand() % 3) {
37 case 0: st->type = SOCK_STREAM;
38 break;
39 case 1: st->type = SOCK_SEQPACKET;
40 break;
41 case 2: st->type = SOCK_DGRAM;
42 break;
43 default: break;