github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/linux/socket_ax25.txt (about)

     1  # Copyright 2017 syzkaller project authors. All rights reserved.
     2  # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  # AF_AX25 support.
     5  
     6  include <linux/socket.h>
     7  include <linux/net.h>
     8  include <linux/if_ether.h>
     9  include <linux/if_arp.h>
    10  include <linux/ax25.h>
    11  include <net/ax25.h>
    12  
    13  resource sock_ax25[sock]
    14  
    15  syz_init_net_socket$ax25(domain const[AF_AX25], type flags[ax25_socket_types], proto flags[ax25_protocols]) sock_ax25
    16  bind$ax25(fd sock_ax25, addr ptr[in, full_sockaddr_ax25], addrlen len[addr])
    17  connect$ax25(fd sock_ax25, addr ptr[in, full_sockaddr_ax25], addrlen len[addr])
    18  accept$ax25(fd sock_ax25, peer ptr[out, full_sockaddr_ax25, opt], peerlen ptr[inout, len[peer, int32]]) sock_ax25
    19  accept4$ax25(fd sock_ax25, peer ptr[out, full_sockaddr_ax25, opt], peerlen ptr[inout, len[peer, int32]], flags flags[accept_flags]) sock_ax25
    20  sendto$ax25(fd sock_ax25, buf ptr[in, array[int8]], len len[buf], f flags[send_flags], addr ptr[in, full_sockaddr_ax25, opt], addrlen len[addr])
    21  recvfrom$ax25(fd sock_ax25, buf ptr[out, array[int8]], len len[buf], f flags[recv_flags], addr ptr[in, full_sockaddr_ax25, opt], addrlen len[addr])
    22  getsockname$ax25(fd sock_ax25, addr ptr[out, full_sockaddr_ax25], addrlen ptr[inout, len[addr, int32]])
    23  getpeername$ax25(fd sock_ax25, peer ptr[out, full_sockaddr_ax25], peerlen ptr[inout, len[peer, int32]])
    24  
    25  ax25_socket_types = SOCK_DGRAM, SOCK_SEQPACKET, SOCK_RAW
    26  ax25_protocols = AX25_P_ROSE, AX25_P_VJCOMP, AX25_P_VJUNCOMP, AX25_P_SEGMENT, AX25_P_TEXNET, AX25_P_LQ, AX25_P_ATALK, AX25_P_ATALK_ARP, AX25_P_IP, AX25_P_ARP, AX25_P_FLEXNET, AX25_P_NETROM, AX25_P_TEXT
    27  
    28  ax25_address [
    29  	remote	ax25_address_remote
    30  	bcast	ax25_address_bcast
    31  	default	ax25_address_default
    32  	null	ax25_address_null
    33  	netrom	address_netrom_dev
    34  # TODO: rose address is 5 bytes, ax25 is 7, should it even be here?
    35  	rose	rose_address_dev
    36  ] [size[7]]
    37  
    38  # Just some address without special meaning.
    39  ax25_address_remote {
    40  	b0	const[0xcc, int8]
    41  	b1	const[0xcc, int8]
    42  	b2	const[0xcc, int8]
    43  	b3	const[0xcc, int8]
    44  	b4	const[0xcc, int8]
    45  	b5	const[0xcc, int8]
    46  	b6	proc[0x0, 4, int8]
    47  }
    48  
    49  # {{'Q' << 1, 'S' << 1, 'T' << 1, ' ' << 1, ' ' << 1, ' ' << 1, 0 << 1}}
    50  ax25_address_bcast {
    51  	b0	const[0xa2, int8]
    52  	b1	const[0xa6, int8]
    53  	b2	const[0xa8, int8]
    54  	b3	const[0x40, int8]
    55  	b4	const[0x40, int8]
    56  	b5	const[0x40, int8]
    57  	b6	const[0x0, int8]
    58  }
    59  
    60  # {{'L' << 1, 'I' << 1, 'N' << 1, 'U' << 1, 'X' << 1, ' ' << 1, 1 << 1}}
    61  ax25_address_default {
    62  	b0	const[0x98, int8]
    63  	b1	const[0x92, int8]
    64  	b2	const[0x9c, int8]
    65  	b3	const[0xaa, int8]
    66  	b4	const[0xb0, int8]
    67  	b5	const[0x40, int8]
    68  	b6	const[0x2, int8]
    69  }
    70  
    71  # {{' ' << 1, ' ' << 1, ' ' << 1, ' ' << 1, ' ' << 1, ' ' << 1, 0 << 1}}
    72  ax25_address_null {
    73  	b0	const[0x40, int8]
    74  	b1	const[0x40, int8]
    75  	b2	const[0x40, int8]
    76  	b3	const[0x40, int8]
    77  	b4	const[0x40, int8]
    78  	b5	const[0x40, int8]
    79  	b6	const[0x0, int8]
    80  }
    81  
    82  sockaddr_ax25 {
    83  	sax25_family	const[AF_AX25, int16]
    84  	sax25_call	ax25_address
    85  	sax25_ndigis	int32[0:AX25_MAX_DIGIS]
    86  }
    87  
    88  sockaddr_ax25_uid {
    89  	sax25_family	const[AF_AX25, int16]
    90  	sax25_call	ax25_address
    91  	sax25_ndigis	uid
    92  }
    93  
    94  full_sockaddr_ax25 {
    95  	fsa_ax25	sockaddr_ax25
    96  	fsa_digipeater	array[ax25_address, AX25_MAX_DIGIS]
    97  }
    98  
    99  # Generic options
   100  
   101  ax25_option_types_int = AX25_WINDOW, AX25_T1, AX25_T2, AX25_N2, AX25_T3, AX25_IDLE, AX25_BACKOFF, AX25_EXTSEQ, AX25_PIDINCL, AX25_IAMDIGI, AX25_PACLEN
   102  
   103  getsockopt$ax25_int(fd sock_ax25, level const[SOL_AX25], optname flags[ax25_option_types_int], optval ptr[out, int32], optlen ptr[inout, len[optval, int32]])
   104  setsockopt$ax25_int(fd sock_ax25, level const[SOL_AX25], optname flags[ax25_option_types_int], optval ptr[in, int32], optlen len[optval])
   105  
   106  setsockopt$ax25_SO_BINDTODEVICE(fd sock_ax25, level const[SOL_AX25], optname const[SO_BINDTODEVICE], optval ptr[in, ax25_devname], optlen len[optval])
   107  
   108  ax25_devname [
   109  	rose	ax25_devname_rose
   110  	netrom	ax25_devname_netrom
   111  	bpq0	string["bpq0", IFNAMSIZ]
   112  ]
   113  
   114  ax25_devname_rose {
   115  	name	stringnoz["rose"]
   116  	id	proc['0', 1, int8]
   117  	z	const[0, int8]
   118  } [size[IFNAMSIZ]]
   119  
   120  ax25_devname_netrom {
   121  	name	stringnoz["nr"]
   122  	id	proc['0', 1, int8]
   123  	z	const[0, int8]
   124  } [size[IFNAMSIZ]]
   125  
   126  ioctl$SIOCAX25ADDUID(fd sock_ax25, cmd const[SIOCAX25ADDUID], arg ptr[in, sockaddr_ax25_uid])
   127  ioctl$SIOCAX25DELUID(fd sock_ax25, cmd const[SIOCAX25DELUID], arg ptr[in, sockaddr_ax25_uid])
   128  ioctl$SIOCAX25GETUID(fd sock_ax25, cmd const[SIOCAX25GETUID], arg ptr[in, sockaddr_ax25_uid])
   129  ioctl$SIOCAX25NOUID(fd sock_ax25, cmd const[SIOCAX25NOUID], arg ptr[in, int64[0:AX25_NOUID_BLOCK]])
   130  ioctl$SIOCAX25CTLCON(fd sock_ax25, cmd const[SIOCAX25CTLCON], arg ptr[in, ax25_ctl_struct])
   131  ioctl$SIOCAX25GETINFO(fd sock_ax25, cmd const[SIOCAX25GETINFO], arg ptr[out, array[int8, AX25_INFO_SIZE]])
   132  ioctl$SIOCAX25GETINFOOLD(fd sock_ax25, cmd const[SIOCAX25GETINFOOLD], arg ptr[out, array[int8, AX25_INFO_OLD_SIZE]])
   133  ioctl$SIOCAX25ADDFWD(fd sock_ax25, cmd const[SIOCAX25ADDFWD], arg ptr[in, ax25_fwd_struct])
   134  ioctl$SIOCAX25DELFWD(fd sock_ax25, cmd const[SIOCAX25DELFWD], arg ptr[in, ax25_fwd_struct])
   135  ioctl$sock_ax25_SIOCADDRT(fd sock_ax25, cmd const[SIOCADDRT], arg ptr[in, ax25_routes_struct])
   136  ioctl$sock_ax25_SIOCDELRT(fd sock_ax25, cmd const[SIOCDELRT], arg ptr[in, ax25_routes_struct])
   137  ioctl$SIOCAX25OPTRT(fd sock_ax25, cmd const[SIOCAX25OPTRT], arg ptr[in, ax25_route_opt_struct])
   138  
   139  define AX25_INFO_SIZE	sizeof(struct ax25_info_struct)
   140  define AX25_INFO_OLD_SIZE	sizeof(struct ax25_info_struct_deprecated)
   141  
   142  ax25_ctl_struct {
   143  	port_addr	ax25_address
   144  	source_addr	ax25_address
   145  	dest_addr	ax25_address
   146  	cmd		flags[ax25_ctl_cmd, int32]
   147  	arg		intptr
   148  	digi_count	int8[0:AX25_MAX_DIGIS]
   149  	digi_addr	array[ax25_address, AX25_MAX_DIGIS]
   150  }
   151  
   152  ax25_ctl_cmd = AX25_WINDOW, AX25_T1, AX25_N2, AX25_T3, AX25_T2, AX25_BACKOFF, AX25_EXTSEQ, AX25_PIDINCL, AX25_IDLE, AX25_PACLEN, AX25_IAMDIGI, AX25_KILL
   153  
   154  ax25_fwd_struct {
   155  	port_from	ax25_address
   156  	port_to		ax25_address
   157  }
   158  
   159  ax25_routes_struct {
   160  	port_addr	ax25_address
   161  	dest_addr	ax25_address
   162  	digi_count	int8[0:AX25_MAX_DIGIS]
   163  	digi_addr	array[ax25_address, AX25_MAX_DIGIS]
   164  }
   165  
   166  ax25_route_opt_struct {
   167  	port_addr	ax25_address
   168  	dest_addr	ax25_address
   169  	cmd		const[AX25_SET_RT_IPMODE, int32]
   170  	arg		flags[ax25_route_ipmodes, int32]
   171  }
   172  
   173  ax25_route_ipmodes = ' ', 'D', 'V'