merge setgid variants
[trinity.git] / ioctls / socket.c
blob250390d0e0f0bd2fac9fc3e7056c87896b6a68a3
1 #include "ioctls.h"
2 #include "net.h"
3 #include "shm.h"
4 #include "utils.h"
6 static int socket_fd_test(int fd, const struct stat *st __attribute__((unused)))
8 unsigned i;
10 for (i=0; i < nr_sockets; ++i)
11 if (shm->sockets[i].fd == fd)
12 return 0;
14 return -1;
17 static const struct ioctl socket_ioctls[] = {
18 { .name = "FIOSETOWN", .request = 0x8901, },
19 { .name = "SIOCSPGRP", .request = 0x8902, },
20 { .name = "FIOGETOWN", .request = 0x8903, },
21 { .name = "SIOCGPGRP", .request = 0x8904, },
22 { .name = "SIOCATMARK", .request = 0x8905, },
23 { .name = "SIOCGSTAMP", .request = 0x8906, },
24 { .name = "SIOCGSTAMPNS", .request = 0x8907, },
25 { .name = "SIOCADDRT", .request = 0x890B, },
26 { .name = "SIOCDELRT", .request = 0x890C, },
27 { .name = "SIOCRTMSG", .request = 0x890D, },
28 { .name = "SIOCGIFNAME", .request = 0x8910, },
29 { .name = "SIOCSIFLINK", .request = 0x8911, },
30 { .name = "SIOCGIFCONF", .request = 0x8912, },
31 { .name = "SIOCGIFFLAGS", .request = 0x8913, },
32 { .name = "SIOCSIFFLAGS", .request = 0x8914, },
33 { .name = "SIOCGIFADDR", .request = 0x8915, },
34 { .name = "SIOCSIFADDR", .request = 0x8916, },
35 { .name = "SIOCGIFDSTADDR", .request = 0x8917, },
36 { .name = "SIOCSIFDSTADDR", .request = 0x8918, },
37 { .name = "SIOCGIFBRDADDR", .request = 0x8919, },
38 { .name = "SIOCSIFBRDADDR", .request = 0x891a, },
39 { .name = "SIOCGIFNETMASK", .request = 0x891b, },
40 { .name = "SIOCSIFNETMASK", .request = 0x891c, },
41 { .name = "SIOCGIFMETRIC", .request = 0x891d, },
42 { .name = "SIOCSIFMETRIC", .request = 0x891e, },
43 { .name = "SIOCGIFMEM", .request = 0x891f, },
44 { .name = "SIOCSIFMEM", .request = 0x8920, },
45 { .name = "SIOCGIFMTU", .request = 0x8921, },
46 { .name = "SIOCSIFMTU", .request = 0x8922, },
47 { .name = "SIOCSIFNAME", .request = 0x8923, },
48 { .name = "SIOCSIFHWADDR", .request = 0x8924, },
49 { .name = "SIOCGIFENCAP", .request = 0x8925, },
50 { .name = "SIOCSIFENCAP", .request = 0x8926, },
51 { .name = "SIOCGIFHWADDR", .request = 0x8927, },
52 { .name = "SIOCGIFSLAVE", .request = 0x8929, },
53 { .name = "SIOCSIFSLAVE", .request = 0x8930, },
54 { .name = "SIOCADDMULTI", .request = 0x8931, },
55 { .name = "SIOCDELMULTI", .request = 0x8932, },
56 { .name = "SIOCGIFINDEX", .request = 0x8933, },
57 { .name = "SIOCSIFPFLAGS", .request = 0x8934, },
58 { .name = "SIOCGIFPFLAGS", .request = 0x8935, },
59 { .name = "SIOCDIFADDR", .request = 0x8936, },
60 { .name = "SIOCSIFHWBROADCAST", .request = 0x8937, },
61 { .name = "SIOCGIFCOUNT", .request = 0x8938, },
62 { .name = "SIOCGIFBR", .request = 0x8940, },
63 { .name = "SIOCSIFBR", .request = 0x8941, },
64 { .name = "SIOCGIFTXQLEN", .request = 0x8942, },
65 { .name = "SIOCSIFTXQLEN", .request = 0x8943, },
66 { .name = "SIOCETHTOOL", .request = 0x8946, },
67 { .name = "SIOCGMIIPHY", .request = 0x8947, },
68 { .name = "SIOCGMIIREG", .request = 0x8948, },
69 { .name = "SIOCSMIIREG", .request = 0x8949, },
70 { .name = "SIOCWANDEV", .request = 0x894A, },
71 { .name = "SIOCDARP", .request = 0x8953, },
72 { .name = "SIOCGARP", .request = 0x8954, },
73 { .name = "SIOCSARP", .request = 0x8955, },
74 { .name = "SIOCDRARP", .request = 0x8960, },
75 { .name = "SIOCGRARP", .request = 0x8961, },
76 { .name = "SIOCSRARP", .request = 0x8962, },
77 { .name = "SIOCGIFMAP", .request = 0x8970, },
78 { .name = "SIOCSIFMAP", .request = 0x8971, },
79 { .name = "SIOCADDDLCI", .request = 0x8980, },
80 { .name = "SIOCDELDLCI", .request = 0x8981, },
81 { .name = "SIOCGIFVLAN", .request = 0x8982, },
82 { .name = "SIOCSIFVLAN", .request = 0x8983, },
83 { .name = "SIOCBONDENSLAVE", .request = 0x8990, },
84 { .name = "SIOCBONDRELEASE", .request = 0x8991, },
85 { .name = "SIOCBONDSETHWADDR", .request = 0x8992, },
86 { .name = "SIOCBONDSLAVEINFOQUERY", .request = 0x8993, },
87 { .name = "SIOCBONDINFOQUERY", .request = 0x8994, },
88 { .name = "SIOCBONDCHANGEACTIVE", .request = 0x8995, },
89 { .name = "SIOCBRADDBR", .request = 0x89a0, },
90 { .name = "SIOCBRDELBR", .request = 0x89a1, },
91 { .name = "SIOCBRADDIF", .request = 0x89a2, },
92 { .name = "SIOCBRDELIF", .request = 0x89a3, },
93 { .name = "SIOCSHWTSTAMP", .request = 0x89b0, },
94 { .name = "SIOCDEVPRIVATE", .request = 0x89F0, },
95 { .name = "SIOCPROTOPRIVATE", .request = 0x89E0, },
96 { .name = "SIOCSIWCOMMIT", .request = 0x8B00, },
97 { .name = "SIOCGIWNAME", .request = 0x8B01, },
98 { .name = "SIOCSIWNWID", .request = 0x8B02, },
99 { .name = "SIOCGIWNWID", .request = 0x8B03, },
100 { .name = "SIOCSIWFREQ", .request = 0x8B04, },
101 { .name = "SIOCGIWFREQ", .request = 0x8B05, },
102 { .name = "SIOCSIWMODE", .request = 0x8B06, },
103 { .name = "SIOCGIWMODE", .request = 0x8B07, },
104 { .name = "SIOCSIWSENS", .request = 0x8B08, },
105 { .name = "SIOCGIWSENS", .request = 0x8B09, },
106 { .name = "SIOCSIWRANGE", .request = 0x8B0A, },
107 { .name = "SIOCGIWRANGE", .request = 0x8B0B, },
108 { .name = "SIOCSIWPRIV", .request = 0x8B0C, },
109 { .name = "SIOCGIWPRIV", .request = 0x8B0D, },
110 { .name = "SIOCSIWSTATS", .request = 0x8B0E, },
111 { .name = "SIOCGIWSTATS", .request = 0x8B0F, },
112 { .name = "SIOCSIWSPY", .request = 0x8B10, },
113 { .name = "SIOCGIWSPY", .request = 0x8B11, },
114 { .name = "SIOCSIWTHRSPY", .request = 0x8B12, },
115 { .name = "SIOCGIWTHRSPY", .request = 0x8B13, },
116 { .name = "SIOCSIWAP", .request = 0x8B14, },
117 { .name = "SIOCGIWAP", .request = 0x8B15, },
118 { .name = "SIOCGIWAPLIST", .request = 0x8B17, },
119 { .name = "SIOCSIWSCAN", .request = 0x8B18, },
120 { .name = "SIOCGIWSCAN", .request = 0x8B19, },
121 { .name = "SIOCSIWESSID", .request = 0x8B1A, },
122 { .name = "SIOCGIWESSID", .request = 0x8B1B, },
123 { .name = "SIOCSIWNICKN", .request = 0x8B1C, },
124 { .name = "SIOCGIWNICKN", .request = 0x8B1D, },
125 { .name = "SIOCSIWRATE", .request = 0x8B20, },
126 { .name = "SIOCGIWRATE", .request = 0x8B21, },
127 { .name = "SIOCSIWRTS", .request = 0x8B22, },
128 { .name = "SIOCGIWRTS", .request = 0x8B23, },
129 { .name = "SIOCSIWFRAG", .request = 0x8B24, },
130 { .name = "SIOCGIWFRAG", .request = 0x8B25, },
131 { .name = "SIOCSIWTXPOW", .request = 0x8B26, },
132 { .name = "SIOCGIWTXPOW", .request = 0x8B27, },
133 { .name = "SIOCSIWRETRY", .request = 0x8B28, },
134 { .name = "SIOCGIWRETRY", .request = 0x8B29, },
135 { .name = "SIOCSIWENCODE", .request = 0x8B2A, },
136 { .name = "SIOCGIWENCODE", .request = 0x8B2B, },
137 { .name = "SIOCSIWPOWER", .request = 0x8B2C, },
138 { .name = "SIOCGIWPOWER", .request = 0x8B2D, },
139 { .name = "SIOCSIWGENIE", .request = 0x8B30, },
140 { .name = "SIOCGIWGENIE", .request = 0x8B31, },
141 { .name = "SIOCSIWMLME", .request = 0x8B16, },
142 { .name = "SIOCSIWAUTH", .request = 0x8B32, },
143 { .name = "SIOCGIWAUTH", .request = 0x8B33, },
144 { .name = "SIOCSIWENCODEEXT", .request = 0x8B34, },
145 { .name = "SIOCGIWENCODEEXT", .request = 0x8B35, },
146 { .name = "SIOCSIWPMKSA", .request = 0x8B36, },
147 { .name = "SIOCIWFIRSTPRIV", .request = 0x8BE0, },
148 { .name = "SIOCIWLASTPRIV", .request = 0x8BFF, },
149 { .name = "SIOCIWFIRST", .request = 0x8B00, },
152 static const struct ioctl_group socket_grp = {
153 .name = "[socket]",
154 .fd_test = socket_fd_test,
155 .sanitise = pick_random_ioctl,
156 .ioctls = socket_ioctls,
157 .ioctls_cnt = ARRAY_SIZE(socket_ioctls),
160 REG_IOCTL_GROUP(socket_grp)