aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorEvgeniy Polyakov <johnpol@2ka.mipt.ru>2005-10-13 17:42:04 -0400
committerDavid S. Miller <davem@davemloft.net>2005-10-13 17:42:04 -0400
commiteb0d6041143fae63410c5622fef96862e6b20933 (patch)
tree28a8f9ed7fc1e60850a06c2f06fe8bbaaa08d073 /Documentation
parent34cb711ba922f53cca45443b8c3c1078873cf599 (diff)
[CONNECTOR]: Update documentation to match reality.
Updated documentation to reflect 2.6.14 netlink changes about socket options, multicasting and group number. Please concider for 2.6.14. Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/connector/connector.txt44
1 files changed, 44 insertions, 0 deletions
diff --git a/Documentation/connector/connector.txt b/Documentation/connector/connector.txt
index 54a0a14bfbe3..57a314b14cf8 100644
--- a/Documentation/connector/connector.txt
+++ b/Documentation/connector/connector.txt
@@ -131,3 +131,47 @@ Netlink itself is not reliable protocol, that means that messages can
131be lost due to memory pressure or process' receiving queue overflowed, 131be lost due to memory pressure or process' receiving queue overflowed,
132so caller is warned must be prepared. That is why struct cn_msg [main 132so caller is warned must be prepared. That is why struct cn_msg [main
133connector's message header] contains u32 seq and u32 ack fields. 133connector's message header] contains u32 seq and u32 ack fields.
134
135/*****************************************/
136Userspace usage.
137/*****************************************/
1382.6.14 has a new netlink socket implementation, which by default does not
139allow to send data to netlink groups other than 1.
140So, if to use netlink socket (for example using connector)
141with different group number userspace application must subscribe to
142that group. It can be achieved by following pseudocode:
143
144s = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR);
145
146l_local.nl_family = AF_NETLINK;
147l_local.nl_groups = 12345;
148l_local.nl_pid = 0;
149
150if (bind(s, (struct sockaddr *)&l_local, sizeof(struct sockaddr_nl)) == -1) {
151 perror("bind");
152 close(s);
153 return -1;
154}
155
156{
157 int on = l_local.nl_groups;
158 setsockopt(s, 270, 1, &on, sizeof(on));
159}
160
161Where 270 above is SOL_NETLINK, and 1 is a NETLINK_ADD_MEMBERSHIP socket
162option. To drop multicast subscription one should call above socket option
163with NETLINK_DROP_MEMBERSHIP parameter which is defined as 0.
164
1652.6.14 netlink code only allows to select a group which is less or equal to
166the maximum group number, which is used at netlink_kernel_create() time.
167In case of connector it is CN_NETLINK_USERS + 0xf, so if you want to use
168group number 12345, you must increment CN_NETLINK_USERS to that number.
169Additional 0xf numbers are allocated to be used by non-in-kernel users.
170
171Due to this limitation, group 0xffffffff does not work now, so one can
172not use add/remove connector's group notifications, but as far as I know,
173only cn_test.c test module used it.
174
175Some work in netlink area is still being done, so things can be changed in
1762.6.15 timeframe, if it will happen, documentation will be updated for that
177kernel.