Commit c9afcf8
committed
Fix done message parse
Though the document of kernel (https://kernel.org/doc/html/next/userspace-api/netlink/intro.html#netlink-message-types)
specify the format of netlink message with NLMSG_DONE, it also says that "Note that some implementations may issue custom NLMSG_DONE messages in reply to do action requests.
In that case the payload is implementation-specific and may also be absent.".
After searching the source code of kernel, we can find that
1. the formant specified in the document is obeyed by most generic
netlink but some generic netlink like this (https://elixir.bootlin.com/linux/v6.15/source/drivers/net/team/team_core.c#L2494) has no payload,
so as a generic lib, we should not suppose the format of DoneMessage.
it's sensible to just save the payload.
2. when use NLMSG_DONE as an end of multi messages, there will always be
a NLM_F_MULTIPART in the flag and only in this case should we parse it
as a DoneMessage, in other occassion like connector netlink
(https://elixir.bootlin.com/linux/v6.15/source/drivers/connector/connector.c#L101),
we should parse it as a common message.
Signed-off-by: feng zhao <[email protected]>1 parent 01e8dd1 commit c9afcf8
2 files changed
+44
-102
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | 3 | | |
6 | 4 | | |
7 | 5 | | |
| |||
11 | 9 | | |
12 | 10 | | |
13 | 11 | | |
14 | | - | |
| 12 | + | |
15 | 13 | | |
16 | | - | |
17 | | - | |
| 14 | + | |
| 15 | + | |
18 | 16 | | |
19 | 17 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
44 | 22 | | |
45 | | - | |
| 23 | + | |
46 | 24 | | |
47 | 25 | | |
48 | 26 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
69 | 33 | | |
70 | | - | |
71 | 34 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
77 | 40 | | |
78 | 41 | | |
79 | 42 | | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | 43 | | |
88 | 44 | | |
89 | | - | |
| 45 | + | |
90 | 46 | | |
91 | 47 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
| 48 | + | |
97 | 49 | | |
98 | 50 | | |
99 | 51 | | |
100 | | - | |
| 52 | + | |
101 | 53 | | |
102 | 54 | | |
103 | | - | |
| 55 | + | |
104 | 56 | | |
105 | | - | |
106 | | - | |
| 57 | + | |
107 | 58 | | |
108 | 59 | | |
109 | 60 | | |
| |||
114 | 65 | | |
115 | 66 | | |
116 | 67 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
| 68 | + | |
122 | 69 | | |
123 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
124 | 74 | | |
125 | 75 | | |
126 | 76 | | |
127 | 77 | | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
134 | 81 | | |
135 | 82 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
110 | 111 | | |
111 | 112 | | |
112 | 113 | | |
| |||
205 | 206 | | |
206 | 207 | | |
207 | 208 | | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
213 | 212 | | |
214 | 213 | | |
215 | 214 | | |
| |||
221 | 220 | | |
222 | 221 | | |
223 | 222 | | |
224 | | - | |
| 223 | + | |
225 | 224 | | |
226 | 225 | | |
227 | 226 | | |
228 | 227 | | |
229 | 228 | | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | 229 | | |
235 | 230 | | |
236 | 231 | | |
| |||
0 commit comments