aboutsummaryrefslogtreecommitdiffstats
path: root/net/llc
diff options
context:
space:
mode:
Diffstat (limited to 'net/llc')
-rw-r--r--net/llc/llc_c_ev.c134
1 files changed, 68 insertions, 66 deletions
diff --git a/net/llc/llc_c_ev.c b/net/llc/llc_c_ev.c
index d5bdb53a348f..c53b82324268 100644
--- a/net/llc/llc_c_ev.c
+++ b/net/llc/llc_c_ev.c
@@ -99,7 +99,7 @@ out:
99 99
100int llc_conn_ev_conn_req(struct sock *sk, struct sk_buff *skb) 100int llc_conn_ev_conn_req(struct sock *sk, struct sk_buff *skb)
101{ 101{
102 struct llc_conn_state_ev *ev = llc_conn_ev(skb); 102 const struct llc_conn_state_ev *ev = llc_conn_ev(skb);
103 103
104 return ev->prim == LLC_CONN_PRIM && 104 return ev->prim == LLC_CONN_PRIM &&
105 ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1; 105 ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1;
@@ -107,7 +107,7 @@ int llc_conn_ev_conn_req(struct sock *sk, struct sk_buff *skb)
107 107
108int llc_conn_ev_data_req(struct sock *sk, struct sk_buff *skb) 108int llc_conn_ev_data_req(struct sock *sk, struct sk_buff *skb)
109{ 109{
110 struct llc_conn_state_ev *ev = llc_conn_ev(skb); 110 const struct llc_conn_state_ev *ev = llc_conn_ev(skb);
111 111
112 return ev->prim == LLC_DATA_PRIM && 112 return ev->prim == LLC_DATA_PRIM &&
113 ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1; 113 ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1;
@@ -115,7 +115,7 @@ int llc_conn_ev_data_req(struct sock *sk, struct sk_buff *skb)
115 115
116int llc_conn_ev_disc_req(struct sock *sk, struct sk_buff *skb) 116int llc_conn_ev_disc_req(struct sock *sk, struct sk_buff *skb)
117{ 117{
118 struct llc_conn_state_ev *ev = llc_conn_ev(skb); 118 const struct llc_conn_state_ev *ev = llc_conn_ev(skb);
119 119
120 return ev->prim == LLC_DISC_PRIM && 120 return ev->prim == LLC_DISC_PRIM &&
121 ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1; 121 ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1;
@@ -123,7 +123,7 @@ int llc_conn_ev_disc_req(struct sock *sk, struct sk_buff *skb)
123 123
124int llc_conn_ev_rst_req(struct sock *sk, struct sk_buff *skb) 124int llc_conn_ev_rst_req(struct sock *sk, struct sk_buff *skb)
125{ 125{
126 struct llc_conn_state_ev *ev = llc_conn_ev(skb); 126 const struct llc_conn_state_ev *ev = llc_conn_ev(skb);
127 127
128 return ev->prim == LLC_RESET_PRIM && 128 return ev->prim == LLC_RESET_PRIM &&
129 ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1; 129 ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1;
@@ -131,7 +131,7 @@ int llc_conn_ev_rst_req(struct sock *sk, struct sk_buff *skb)
131 131
132int llc_conn_ev_local_busy_detected(struct sock *sk, struct sk_buff *skb) 132int llc_conn_ev_local_busy_detected(struct sock *sk, struct sk_buff *skb)
133{ 133{
134 struct llc_conn_state_ev *ev = llc_conn_ev(skb); 134 const struct llc_conn_state_ev *ev = llc_conn_ev(skb);
135 135
136 return ev->type == LLC_CONN_EV_TYPE_SIMPLE && 136 return ev->type == LLC_CONN_EV_TYPE_SIMPLE &&
137 ev->prim_type == LLC_CONN_EV_LOCAL_BUSY_DETECTED ? 0 : 1; 137 ev->prim_type == LLC_CONN_EV_LOCAL_BUSY_DETECTED ? 0 : 1;
@@ -139,7 +139,7 @@ int llc_conn_ev_local_busy_detected(struct sock *sk, struct sk_buff *skb)
139 139
140int llc_conn_ev_local_busy_cleared(struct sock *sk, struct sk_buff *skb) 140int llc_conn_ev_local_busy_cleared(struct sock *sk, struct sk_buff *skb)
141{ 141{
142 struct llc_conn_state_ev *ev = llc_conn_ev(skb); 142 const struct llc_conn_state_ev *ev = llc_conn_ev(skb);
143 143
144 return ev->type == LLC_CONN_EV_TYPE_SIMPLE && 144 return ev->type == LLC_CONN_EV_TYPE_SIMPLE &&
145 ev->prim_type == LLC_CONN_EV_LOCAL_BUSY_CLEARED ? 0 : 1; 145 ev->prim_type == LLC_CONN_EV_LOCAL_BUSY_CLEARED ? 0 : 1;
@@ -152,7 +152,7 @@ int llc_conn_ev_rx_bad_pdu(struct sock *sk, struct sk_buff *skb)
152 152
153int llc_conn_ev_rx_disc_cmd_pbit_set_x(struct sock *sk, struct sk_buff *skb) 153int llc_conn_ev_rx_disc_cmd_pbit_set_x(struct sock *sk, struct sk_buff *skb)
154{ 154{
155 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); 155 const struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
156 156
157 return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_U(pdu) && 157 return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_U(pdu) &&
158 LLC_U_PDU_CMD(pdu) == LLC_2_PDU_CMD_DISC ? 0 : 1; 158 LLC_U_PDU_CMD(pdu) == LLC_2_PDU_CMD_DISC ? 0 : 1;
@@ -160,7 +160,7 @@ int llc_conn_ev_rx_disc_cmd_pbit_set_x(struct sock *sk, struct sk_buff *skb)
160 160
161int llc_conn_ev_rx_dm_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb) 161int llc_conn_ev_rx_dm_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb)
162{ 162{
163 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); 163 const struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
164 164
165 return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_U(pdu) && 165 return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_U(pdu) &&
166 LLC_U_PDU_RSP(pdu) == LLC_2_PDU_RSP_DM ? 0 : 1; 166 LLC_U_PDU_RSP(pdu) == LLC_2_PDU_RSP_DM ? 0 : 1;
@@ -168,7 +168,7 @@ int llc_conn_ev_rx_dm_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb)
168 168
169int llc_conn_ev_rx_frmr_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb) 169int llc_conn_ev_rx_frmr_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb)
170{ 170{
171 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); 171 const struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
172 172
173 return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_U(pdu) && 173 return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_U(pdu) &&
174 LLC_U_PDU_RSP(pdu) == LLC_2_PDU_RSP_FRMR ? 0 : 1; 174 LLC_U_PDU_RSP(pdu) == LLC_2_PDU_RSP_FRMR ? 0 : 1;
@@ -176,7 +176,7 @@ int llc_conn_ev_rx_frmr_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb)
176 176
177int llc_conn_ev_rx_i_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb) 177int llc_conn_ev_rx_i_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb)
178{ 178{
179 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 179 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
180 180
181 return llc_conn_space(sk, skb) && 181 return llc_conn_space(sk, skb) &&
182 LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_I(pdu) && 182 LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_I(pdu) &&
@@ -186,7 +186,7 @@ int llc_conn_ev_rx_i_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb)
186 186
187int llc_conn_ev_rx_i_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb) 187int llc_conn_ev_rx_i_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb)
188{ 188{
189 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 189 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
190 190
191 return llc_conn_space(sk, skb) && 191 return llc_conn_space(sk, skb) &&
192 LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_I(pdu) && 192 LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_I(pdu) &&
@@ -197,9 +197,9 @@ int llc_conn_ev_rx_i_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb)
197int llc_conn_ev_rx_i_cmd_pbit_set_0_unexpd_ns(struct sock *sk, 197int llc_conn_ev_rx_i_cmd_pbit_set_0_unexpd_ns(struct sock *sk,
198 struct sk_buff *skb) 198 struct sk_buff *skb)
199{ 199{
200 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 200 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
201 u8 vr = llc_sk(sk)->vR; 201 const u8 vr = llc_sk(sk)->vR;
202 u8 ns = LLC_I_GET_NS(pdu); 202 const u8 ns = LLC_I_GET_NS(pdu);
203 203
204 return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_I(pdu) && 204 return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_I(pdu) &&
205 LLC_I_PF_IS_0(pdu) && ns != vr && 205 LLC_I_PF_IS_0(pdu) && ns != vr &&
@@ -209,9 +209,9 @@ int llc_conn_ev_rx_i_cmd_pbit_set_0_unexpd_ns(struct sock *sk,
209int llc_conn_ev_rx_i_cmd_pbit_set_1_unexpd_ns(struct sock *sk, 209int llc_conn_ev_rx_i_cmd_pbit_set_1_unexpd_ns(struct sock *sk,
210 struct sk_buff *skb) 210 struct sk_buff *skb)
211{ 211{
212 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 212 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
213 u8 vr = llc_sk(sk)->vR; 213 const u8 vr = llc_sk(sk)->vR;
214 u8 ns = LLC_I_GET_NS(pdu); 214 const u8 ns = LLC_I_GET_NS(pdu);
215 215
216 return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_I(pdu) && 216 return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_I(pdu) &&
217 LLC_I_PF_IS_1(pdu) && ns != vr && 217 LLC_I_PF_IS_1(pdu) && ns != vr &&
@@ -221,10 +221,11 @@ int llc_conn_ev_rx_i_cmd_pbit_set_1_unexpd_ns(struct sock *sk,
221int llc_conn_ev_rx_i_cmd_pbit_set_x_inval_ns(struct sock *sk, 221int llc_conn_ev_rx_i_cmd_pbit_set_x_inval_ns(struct sock *sk,
222 struct sk_buff *skb) 222 struct sk_buff *skb)
223{ 223{
224 struct llc_pdu_sn * pdu = llc_pdu_sn_hdr(skb); 224 const struct llc_pdu_sn * pdu = llc_pdu_sn_hdr(skb);
225 u8 vr = llc_sk(sk)->vR; 225 const u8 vr = llc_sk(sk)->vR;
226 u8 ns = LLC_I_GET_NS(pdu); 226 const u8 ns = LLC_I_GET_NS(pdu);
227 u16 rc = LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_I(pdu) && ns != vr && 227 const u16 rc = LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_I(pdu) &&
228 ns != vr &&
228 llc_util_ns_inside_rx_window(ns, vr, llc_sk(sk)->rw) ? 0 : 1; 229 llc_util_ns_inside_rx_window(ns, vr, llc_sk(sk)->rw) ? 0 : 1;
229 if (!rc) 230 if (!rc)
230 dprintk("%s: matched, state=%d, ns=%d, vr=%d\n", 231 dprintk("%s: matched, state=%d, ns=%d, vr=%d\n",
@@ -234,7 +235,7 @@ int llc_conn_ev_rx_i_cmd_pbit_set_x_inval_ns(struct sock *sk,
234 235
235int llc_conn_ev_rx_i_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb) 236int llc_conn_ev_rx_i_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb)
236{ 237{
237 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 238 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
238 239
239 return llc_conn_space(sk, skb) && 240 return llc_conn_space(sk, skb) &&
240 LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_I(pdu) && 241 LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_I(pdu) &&
@@ -244,7 +245,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb)
244 245
245int llc_conn_ev_rx_i_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb) 246int llc_conn_ev_rx_i_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb)
246{ 247{
247 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 248 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
248 249
249 return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_I(pdu) && 250 return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_I(pdu) &&
250 LLC_I_PF_IS_1(pdu) && 251 LLC_I_PF_IS_1(pdu) &&
@@ -253,7 +254,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb)
253 254
254int llc_conn_ev_rx_i_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb) 255int llc_conn_ev_rx_i_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb)
255{ 256{
256 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 257 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
257 258
258 return llc_conn_space(sk, skb) && 259 return llc_conn_space(sk, skb) &&
259 LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_I(pdu) && 260 LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_I(pdu) &&
@@ -263,9 +264,9 @@ int llc_conn_ev_rx_i_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb)
263int llc_conn_ev_rx_i_rsp_fbit_set_0_unexpd_ns(struct sock *sk, 264int llc_conn_ev_rx_i_rsp_fbit_set_0_unexpd_ns(struct sock *sk,
264 struct sk_buff *skb) 265 struct sk_buff *skb)
265{ 266{
266 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 267 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
267 u8 vr = llc_sk(sk)->vR; 268 const u8 vr = llc_sk(sk)->vR;
268 u8 ns = LLC_I_GET_NS(pdu); 269 const u8 ns = LLC_I_GET_NS(pdu);
269 270
270 return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_I(pdu) && 271 return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_I(pdu) &&
271 LLC_I_PF_IS_0(pdu) && ns != vr && 272 LLC_I_PF_IS_0(pdu) && ns != vr &&
@@ -275,9 +276,9 @@ int llc_conn_ev_rx_i_rsp_fbit_set_0_unexpd_ns(struct sock *sk,
275int llc_conn_ev_rx_i_rsp_fbit_set_1_unexpd_ns(struct sock *sk, 276int llc_conn_ev_rx_i_rsp_fbit_set_1_unexpd_ns(struct sock *sk,
276 struct sk_buff *skb) 277 struct sk_buff *skb)
277{ 278{
278 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 279 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
279 u8 vr = llc_sk(sk)->vR; 280 const u8 vr = llc_sk(sk)->vR;
280 u8 ns = LLC_I_GET_NS(pdu); 281 const u8 ns = LLC_I_GET_NS(pdu);
281 282
282 return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_I(pdu) && 283 return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_I(pdu) &&
283 LLC_I_PF_IS_1(pdu) && ns != vr && 284 LLC_I_PF_IS_1(pdu) && ns != vr &&
@@ -287,9 +288,9 @@ int llc_conn_ev_rx_i_rsp_fbit_set_1_unexpd_ns(struct sock *sk,
287int llc_conn_ev_rx_i_rsp_fbit_set_x_unexpd_ns(struct sock *sk, 288int llc_conn_ev_rx_i_rsp_fbit_set_x_unexpd_ns(struct sock *sk,
288 struct sk_buff *skb) 289 struct sk_buff *skb)
289{ 290{
290 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 291 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
291 u8 vr = llc_sk(sk)->vR; 292 const u8 vr = llc_sk(sk)->vR;
292 u8 ns = LLC_I_GET_NS(pdu); 293 const u8 ns = LLC_I_GET_NS(pdu);
293 294
294 return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_I(pdu) && ns != vr && 295 return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_I(pdu) && ns != vr &&
295 !llc_util_ns_inside_rx_window(ns, vr, llc_sk(sk)->rw) ? 0 : 1; 296 !llc_util_ns_inside_rx_window(ns, vr, llc_sk(sk)->rw) ? 0 : 1;
@@ -298,10 +299,11 @@ int llc_conn_ev_rx_i_rsp_fbit_set_x_unexpd_ns(struct sock *sk,
298int llc_conn_ev_rx_i_rsp_fbit_set_x_inval_ns(struct sock *sk, 299int llc_conn_ev_rx_i_rsp_fbit_set_x_inval_ns(struct sock *sk,
299 struct sk_buff *skb) 300 struct sk_buff *skb)
300{ 301{
301 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 302 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
302 u8 vr = llc_sk(sk)->vR; 303 const u8 vr = llc_sk(sk)->vR;
303 u8 ns = LLC_I_GET_NS(pdu); 304 const u8 ns = LLC_I_GET_NS(pdu);
304 u16 rc = LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_I(pdu) && ns != vr && 305 const u16 rc = LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_I(pdu) &&
306 ns != vr &&
305 llc_util_ns_inside_rx_window(ns, vr, llc_sk(sk)->rw) ? 0 : 1; 307 llc_util_ns_inside_rx_window(ns, vr, llc_sk(sk)->rw) ? 0 : 1;
306 if (!rc) 308 if (!rc)
307 dprintk("%s: matched, state=%d, ns=%d, vr=%d\n", 309 dprintk("%s: matched, state=%d, ns=%d, vr=%d\n",
@@ -311,7 +313,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_x_inval_ns(struct sock *sk,
311 313
312int llc_conn_ev_rx_rej_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb) 314int llc_conn_ev_rx_rej_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb)
313{ 315{
314 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 316 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
315 317
316 return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_S(pdu) && 318 return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_S(pdu) &&
317 LLC_S_PF_IS_0(pdu) && 319 LLC_S_PF_IS_0(pdu) &&
@@ -320,7 +322,7 @@ int llc_conn_ev_rx_rej_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb)
320 322
321int llc_conn_ev_rx_rej_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb) 323int llc_conn_ev_rx_rej_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb)
322{ 324{
323 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 325 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
324 326
325 return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_S(pdu) && 327 return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_S(pdu) &&
326 LLC_S_PF_IS_1(pdu) && 328 LLC_S_PF_IS_1(pdu) &&
@@ -329,7 +331,7 @@ int llc_conn_ev_rx_rej_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb)
329 331
330int llc_conn_ev_rx_rej_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb) 332int llc_conn_ev_rx_rej_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb)
331{ 333{
332 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 334 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
333 335
334 return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_S(pdu) && 336 return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_S(pdu) &&
335 LLC_S_PF_IS_0(pdu) && 337 LLC_S_PF_IS_0(pdu) &&
@@ -338,7 +340,7 @@ int llc_conn_ev_rx_rej_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb)
338 340
339int llc_conn_ev_rx_rej_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb) 341int llc_conn_ev_rx_rej_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb)
340{ 342{
341 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 343 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
342 344
343 return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_S(pdu) && 345 return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_S(pdu) &&
344 LLC_S_PF_IS_1(pdu) && 346 LLC_S_PF_IS_1(pdu) &&
@@ -347,7 +349,7 @@ int llc_conn_ev_rx_rej_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb)
347 349
348int llc_conn_ev_rx_rej_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb) 350int llc_conn_ev_rx_rej_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb)
349{ 351{
350 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); 352 const struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
351 353
352 return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_S(pdu) && 354 return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_S(pdu) &&
353 LLC_S_PDU_RSP(pdu) == LLC_2_PDU_RSP_REJ ? 0 : 1; 355 LLC_S_PDU_RSP(pdu) == LLC_2_PDU_RSP_REJ ? 0 : 1;
@@ -355,7 +357,7 @@ int llc_conn_ev_rx_rej_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb)
355 357
356int llc_conn_ev_rx_rnr_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb) 358int llc_conn_ev_rx_rnr_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb)
357{ 359{
358 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 360 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
359 361
360 return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_S(pdu) && 362 return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_S(pdu) &&
361 LLC_S_PF_IS_0(pdu) && 363 LLC_S_PF_IS_0(pdu) &&
@@ -364,7 +366,7 @@ int llc_conn_ev_rx_rnr_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb)
364 366
365int llc_conn_ev_rx_rnr_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb) 367int llc_conn_ev_rx_rnr_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb)
366{ 368{
367 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 369 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
368 370
369 return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_S(pdu) && 371 return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_S(pdu) &&
370 LLC_S_PF_IS_1(pdu) && 372 LLC_S_PF_IS_1(pdu) &&
@@ -373,7 +375,7 @@ int llc_conn_ev_rx_rnr_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb)
373 375
374int llc_conn_ev_rx_rnr_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb) 376int llc_conn_ev_rx_rnr_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb)
375{ 377{
376 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 378 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
377 379
378 return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_S(pdu) && 380 return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_S(pdu) &&
379 LLC_S_PF_IS_0(pdu) && 381 LLC_S_PF_IS_0(pdu) &&
@@ -382,7 +384,7 @@ int llc_conn_ev_rx_rnr_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb)
382 384
383int llc_conn_ev_rx_rnr_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb) 385int llc_conn_ev_rx_rnr_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb)
384{ 386{
385 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 387 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
386 388
387 return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_S(pdu) && 389 return LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_S(pdu) &&
388 LLC_S_PF_IS_1(pdu) && 390 LLC_S_PF_IS_1(pdu) &&
@@ -391,7 +393,7 @@ int llc_conn_ev_rx_rnr_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb)
391 393
392int llc_conn_ev_rx_rr_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb) 394int llc_conn_ev_rx_rr_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb)
393{ 395{
394 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 396 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
395 397
396 return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_S(pdu) && 398 return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_S(pdu) &&
397 LLC_S_PF_IS_0(pdu) && 399 LLC_S_PF_IS_0(pdu) &&
@@ -400,7 +402,7 @@ int llc_conn_ev_rx_rr_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb)
400 402
401int llc_conn_ev_rx_rr_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb) 403int llc_conn_ev_rx_rr_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb)
402{ 404{
403 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 405 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
404 406
405 return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_S(pdu) && 407 return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_S(pdu) &&
406 LLC_S_PF_IS_1(pdu) && 408 LLC_S_PF_IS_1(pdu) &&
@@ -409,7 +411,7 @@ int llc_conn_ev_rx_rr_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb)
409 411
410int llc_conn_ev_rx_rr_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb) 412int llc_conn_ev_rx_rr_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb)
411{ 413{
412 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 414 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
413 415
414 return llc_conn_space(sk, skb) && 416 return llc_conn_space(sk, skb) &&
415 LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_S(pdu) && 417 LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_S(pdu) &&
@@ -419,7 +421,7 @@ int llc_conn_ev_rx_rr_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb)
419 421
420int llc_conn_ev_rx_rr_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb) 422int llc_conn_ev_rx_rr_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb)
421{ 423{
422 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 424 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
423 425
424 return llc_conn_space(sk, skb) && 426 return llc_conn_space(sk, skb) &&
425 LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_S(pdu) && 427 LLC_PDU_IS_RSP(pdu) && LLC_PDU_TYPE_IS_S(pdu) &&
@@ -429,7 +431,7 @@ int llc_conn_ev_rx_rr_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb)
429 431
430int llc_conn_ev_rx_sabme_cmd_pbit_set_x(struct sock *sk, struct sk_buff *skb) 432int llc_conn_ev_rx_sabme_cmd_pbit_set_x(struct sock *sk, struct sk_buff *skb)
431{ 433{
432 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); 434 const struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
433 435
434 return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_U(pdu) && 436 return LLC_PDU_IS_CMD(pdu) && LLC_PDU_TYPE_IS_U(pdu) &&
435 LLC_U_PDU_CMD(pdu) == LLC_2_PDU_CMD_SABME ? 0 : 1; 437 LLC_U_PDU_CMD(pdu) == LLC_2_PDU_CMD_SABME ? 0 : 1;
@@ -446,7 +448,7 @@ int llc_conn_ev_rx_ua_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb)
446int llc_conn_ev_rx_xxx_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb) 448int llc_conn_ev_rx_xxx_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb)
447{ 449{
448 u16 rc = 1; 450 u16 rc = 1;
449 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 451 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
450 452
451 if (LLC_PDU_IS_CMD(pdu)) { 453 if (LLC_PDU_IS_CMD(pdu)) {
452 if (LLC_PDU_TYPE_IS_I(pdu) || LLC_PDU_TYPE_IS_S(pdu)) { 454 if (LLC_PDU_TYPE_IS_I(pdu) || LLC_PDU_TYPE_IS_S(pdu)) {
@@ -461,7 +463,7 @@ int llc_conn_ev_rx_xxx_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb)
461int llc_conn_ev_rx_xxx_cmd_pbit_set_x(struct sock *sk, struct sk_buff *skb) 463int llc_conn_ev_rx_xxx_cmd_pbit_set_x(struct sock *sk, struct sk_buff *skb)
462{ 464{
463 u16 rc = 1; 465 u16 rc = 1;
464 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); 466 const struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
465 467
466 if (LLC_PDU_IS_CMD(pdu)) { 468 if (LLC_PDU_IS_CMD(pdu)) {
467 if (LLC_PDU_TYPE_IS_I(pdu) || LLC_PDU_TYPE_IS_S(pdu)) 469 if (LLC_PDU_TYPE_IS_I(pdu) || LLC_PDU_TYPE_IS_S(pdu))
@@ -480,7 +482,7 @@ int llc_conn_ev_rx_xxx_cmd_pbit_set_x(struct sock *sk, struct sk_buff *skb)
480int llc_conn_ev_rx_xxx_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb) 482int llc_conn_ev_rx_xxx_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb)
481{ 483{
482 u16 rc = 1; 484 u16 rc = 1;
483 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 485 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
484 486
485 if (LLC_PDU_IS_RSP(pdu)) { 487 if (LLC_PDU_IS_RSP(pdu)) {
486 if (LLC_PDU_TYPE_IS_I(pdu) || LLC_PDU_TYPE_IS_S(pdu)) { 488 if (LLC_PDU_TYPE_IS_I(pdu) || LLC_PDU_TYPE_IS_S(pdu)) {
@@ -502,7 +504,7 @@ int llc_conn_ev_rx_xxx_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb)
502int llc_conn_ev_rx_xxx_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb) 504int llc_conn_ev_rx_xxx_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb)
503{ 505{
504 u16 rc = 1; 506 u16 rc = 1;
505 struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); 507 const struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
506 508
507 if (LLC_PDU_IS_RSP(pdu)) { 509 if (LLC_PDU_IS_RSP(pdu)) {
508 if (LLC_PDU_TYPE_IS_I(pdu) || LLC_PDU_TYPE_IS_S(pdu)) 510 if (LLC_PDU_TYPE_IS_I(pdu) || LLC_PDU_TYPE_IS_S(pdu))
@@ -524,9 +526,9 @@ int llc_conn_ev_rx_zzz_cmd_pbit_set_x_inval_nr(struct sock *sk,
524 struct sk_buff *skb) 526 struct sk_buff *skb)
525{ 527{
526 u16 rc = 1; 528 u16 rc = 1;
527 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 529 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
528 u8 vs = llc_sk(sk)->vS; 530 const u8 vs = llc_sk(sk)->vS;
529 u8 nr = LLC_I_GET_NR(pdu); 531 const u8 nr = LLC_I_GET_NR(pdu);
530 532
531 if (LLC_PDU_IS_CMD(pdu) && 533 if (LLC_PDU_IS_CMD(pdu) &&
532 (LLC_PDU_TYPE_IS_I(pdu) || LLC_PDU_TYPE_IS_S(pdu)) && 534 (LLC_PDU_TYPE_IS_I(pdu) || LLC_PDU_TYPE_IS_S(pdu)) &&
@@ -542,9 +544,9 @@ int llc_conn_ev_rx_zzz_rsp_fbit_set_x_inval_nr(struct sock *sk,
542 struct sk_buff *skb) 544 struct sk_buff *skb)
543{ 545{
544 u16 rc = 1; 546 u16 rc = 1;
545 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 547 const struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
546 u8 vs = llc_sk(sk)->vS; 548 const u8 vs = llc_sk(sk)->vS;
547 u8 nr = LLC_I_GET_NR(pdu); 549 const u8 nr = LLC_I_GET_NR(pdu);
548 550
549 if (LLC_PDU_IS_RSP(pdu) && 551 if (LLC_PDU_IS_RSP(pdu) &&
550 (LLC_PDU_TYPE_IS_I(pdu) || LLC_PDU_TYPE_IS_S(pdu)) && 552 (LLC_PDU_TYPE_IS_I(pdu) || LLC_PDU_TYPE_IS_S(pdu)) &&
@@ -563,28 +565,28 @@ int llc_conn_ev_rx_any_frame(struct sock *sk, struct sk_buff *skb)
563 565
564int llc_conn_ev_p_tmr_exp(struct sock *sk, struct sk_buff *skb) 566int llc_conn_ev_p_tmr_exp(struct sock *sk, struct sk_buff *skb)
565{ 567{
566 struct llc_conn_state_ev *ev = llc_conn_ev(skb); 568 const struct llc_conn_state_ev *ev = llc_conn_ev(skb);
567 569
568 return ev->type != LLC_CONN_EV_TYPE_P_TMR; 570 return ev->type != LLC_CONN_EV_TYPE_P_TMR;
569} 571}
570 572
571int llc_conn_ev_ack_tmr_exp(struct sock *sk, struct sk_buff *skb) 573int llc_conn_ev_ack_tmr_exp(struct sock *sk, struct sk_buff *skb)
572{ 574{
573 struct llc_conn_state_ev *ev = llc_conn_ev(skb); 575 const struct llc_conn_state_ev *ev = llc_conn_ev(skb);
574 576
575 return ev->type != LLC_CONN_EV_TYPE_ACK_TMR; 577 return ev->type != LLC_CONN_EV_TYPE_ACK_TMR;
576} 578}
577 579
578int llc_conn_ev_rej_tmr_exp(struct sock *sk, struct sk_buff *skb) 580int llc_conn_ev_rej_tmr_exp(struct sock *sk, struct sk_buff *skb)
579{ 581{
580 struct llc_conn_state_ev *ev = llc_conn_ev(skb); 582 const struct llc_conn_state_ev *ev = llc_conn_ev(skb);
581 583
582 return ev->type != LLC_CONN_EV_TYPE_REJ_TMR; 584 return ev->type != LLC_CONN_EV_TYPE_REJ_TMR;
583} 585}
584 586
585int llc_conn_ev_busy_tmr_exp(struct sock *sk, struct sk_buff *skb) 587int llc_conn_ev_busy_tmr_exp(struct sock *sk, struct sk_buff *skb)
586{ 588{
587 struct llc_conn_state_ev *ev = llc_conn_ev(skb); 589 const struct llc_conn_state_ev *ev = llc_conn_ev(skb);
588 590
589 return ev->type != LLC_CONN_EV_TYPE_BUSY_TMR; 591 return ev->type != LLC_CONN_EV_TYPE_BUSY_TMR;
590} 592}
@@ -596,7 +598,7 @@ int llc_conn_ev_init_p_f_cycle(struct sock *sk, struct sk_buff *skb)
596 598
597int llc_conn_ev_tx_buffer_full(struct sock *sk, struct sk_buff *skb) 599int llc_conn_ev_tx_buffer_full(struct sock *sk, struct sk_buff *skb)
598{ 600{
599 struct llc_conn_state_ev *ev = llc_conn_ev(skb); 601 const struct llc_conn_state_ev *ev = llc_conn_ev(skb);
600 602
601 return ev->type == LLC_CONN_EV_TYPE_SIMPLE && 603 return ev->type == LLC_CONN_EV_TYPE_SIMPLE &&
602 ev->prim_type == LLC_CONN_EV_TX_BUFF_FULL ? 0 : 1; 604 ev->prim_type == LLC_CONN_EV_TX_BUFF_FULL ? 0 : 1;