b27e09d1e2e454498e05b2e6b2bebbe005d07964
[firefly-linux-kernel-4.4.55.git] / drivers / net / bonding / bond_netlink.c
1 /*
2  * drivers/net/bond/bond_netlink.c - Netlink interface for bonding
3  * Copyright (c) 2013 Jiri Pirko <jiri@resnulli.us>
4  * Copyright (c) 2013 Scott Feldman <sfeldma@cumulusnetworks.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  */
11
12 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
13
14 #include <linux/module.h>
15 #include <linux/errno.h>
16 #include <linux/netdevice.h>
17 #include <linux/etherdevice.h>
18 #include <linux/if_link.h>
19 #include <linux/if_ether.h>
20 #include <net/netlink.h>
21 #include <net/rtnetlink.h>
22 #include "bonding.h"
23
24 int bond_get_slave(struct net_device *slave_dev, struct sk_buff *skb)
25 {
26         struct slave *slave = bond_slave_get_rtnl(slave_dev);
27         const struct aggregator *agg;
28
29         if (nla_put_u8(skb, IFLA_SLAVE_STATE, bond_slave_state(slave)))
30                 goto nla_put_failure;
31
32         if (nla_put_u8(skb, IFLA_SLAVE_MII_STATUS, slave->link))
33                 goto nla_put_failure;
34
35         if (nla_put_u32(skb, IFLA_SLAVE_LINK_FAILURE_COUNT,
36                         slave->link_failure_count))
37                 goto nla_put_failure;
38
39         if (nla_put(skb, IFLA_SLAVE_PERM_HWADDR,
40                     slave_dev->addr_len, slave->perm_hwaddr))
41                 goto nla_put_failure;
42
43         if (nla_put_u16(skb, IFLA_SLAVE_QUEUE_ID, slave->queue_id))
44                 goto nla_put_failure;
45
46         if (slave->bond->params.mode == BOND_MODE_8023AD) {
47                 agg = SLAVE_AD_INFO(slave).port.aggregator;
48                 if (agg)
49                         if (nla_put_u16(skb, IFLA_SLAVE_AD_AGGREGATOR_ID,
50                                         agg->aggregator_identifier))
51                                 goto nla_put_failure;
52         }
53
54         return 0;
55
56 nla_put_failure:
57         return -EMSGSIZE;
58 }
59
60 static const struct nla_policy bond_policy[IFLA_BOND_MAX + 1] = {
61         [IFLA_BOND_MODE]                = { .type = NLA_U8 },
62         [IFLA_BOND_ACTIVE_SLAVE]        = { .type = NLA_U32 },
63         [IFLA_BOND_MIIMON]              = { .type = NLA_U32 },
64         [IFLA_BOND_UPDELAY]             = { .type = NLA_U32 },
65         [IFLA_BOND_DOWNDELAY]           = { .type = NLA_U32 },
66         [IFLA_BOND_USE_CARRIER]         = { .type = NLA_U8 },
67         [IFLA_BOND_ARP_INTERVAL]        = { .type = NLA_U32 },
68         [IFLA_BOND_ARP_IP_TARGET]       = { .type = NLA_NESTED },
69         [IFLA_BOND_ARP_VALIDATE]        = { .type = NLA_U32 },
70         [IFLA_BOND_ARP_ALL_TARGETS]     = { .type = NLA_U32 },
71         [IFLA_BOND_PRIMARY]             = { .type = NLA_U32 },
72         [IFLA_BOND_PRIMARY_RESELECT]    = { .type = NLA_U8 },
73         [IFLA_BOND_FAIL_OVER_MAC]       = { .type = NLA_U8 },
74         [IFLA_BOND_XMIT_HASH_POLICY]    = { .type = NLA_U8 },
75         [IFLA_BOND_RESEND_IGMP]         = { .type = NLA_U32 },
76         [IFLA_BOND_NUM_PEER_NOTIF]      = { .type = NLA_U8 },
77         [IFLA_BOND_ALL_SLAVES_ACTIVE]   = { .type = NLA_U8 },
78         [IFLA_BOND_MIN_LINKS]           = { .type = NLA_U32 },
79         [IFLA_BOND_LP_INTERVAL]         = { .type = NLA_U32 },
80         [IFLA_BOND_PACKETS_PER_SLAVE]   = { .type = NLA_U32 },
81         [IFLA_BOND_AD_LACP_RATE]        = { .type = NLA_U8 },
82         [IFLA_BOND_AD_SELECT]           = { .type = NLA_U8 },
83         [IFLA_BOND_AD_INFO]             = { .type = NLA_NESTED },
84 };
85
86 static int bond_validate(struct nlattr *tb[], struct nlattr *data[])
87 {
88         if (tb[IFLA_ADDRESS]) {
89                 if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN)
90                         return -EINVAL;
91                 if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS])))
92                         return -EADDRNOTAVAIL;
93         }
94         return 0;
95 }
96
97 static int bond_changelink(struct net_device *bond_dev,
98                            struct nlattr *tb[], struct nlattr *data[])
99 {
100         struct bonding *bond = netdev_priv(bond_dev);
101         struct bond_opt_value newval;
102         int miimon = 0;
103         int err;
104
105         if (!data)
106                 return 0;
107
108         if (data[IFLA_BOND_MODE]) {
109                 int mode = nla_get_u8(data[IFLA_BOND_MODE]);
110
111                 bond_opt_initval(&newval, mode);
112                 err = __bond_opt_set(bond, BOND_OPT_MODE, &newval);
113                 if (err)
114                         return err;
115         }
116         if (data[IFLA_BOND_ACTIVE_SLAVE]) {
117                 int ifindex = nla_get_u32(data[IFLA_BOND_ACTIVE_SLAVE]);
118                 struct net_device *slave_dev;
119
120                 if (ifindex == 0) {
121                         slave_dev = NULL;
122                 } else {
123                         slave_dev = __dev_get_by_index(dev_net(bond_dev),
124                                                        ifindex);
125                         if (!slave_dev)
126                                 return -ENODEV;
127                 }
128                 err = bond_option_active_slave_set(bond, slave_dev);
129                 if (err)
130                         return err;
131         }
132         if (data[IFLA_BOND_MIIMON]) {
133                 miimon = nla_get_u32(data[IFLA_BOND_MIIMON]);
134
135                 bond_opt_initval(&newval, miimon);
136                 err = __bond_opt_set(bond, BOND_OPT_MIIMON, &newval);
137                 if (err)
138                         return err;
139         }
140         if (data[IFLA_BOND_UPDELAY]) {
141                 int updelay = nla_get_u32(data[IFLA_BOND_UPDELAY]);
142
143                 bond_opt_initval(&newval, updelay);
144                 err = __bond_opt_set(bond, BOND_OPT_UPDELAY, &newval);
145                 if (err)
146                         return err;
147         }
148         if (data[IFLA_BOND_DOWNDELAY]) {
149                 int downdelay = nla_get_u32(data[IFLA_BOND_DOWNDELAY]);
150
151                 bond_opt_initval(&newval, downdelay);
152                 err = __bond_opt_set(bond, BOND_OPT_DOWNDELAY, &newval);
153                 if (err)
154                         return err;
155         }
156         if (data[IFLA_BOND_USE_CARRIER]) {
157                 int use_carrier = nla_get_u8(data[IFLA_BOND_USE_CARRIER]);
158
159                 err = bond_option_use_carrier_set(bond, use_carrier);
160                 if (err)
161                         return err;
162         }
163         if (data[IFLA_BOND_ARP_INTERVAL]) {
164                 int arp_interval = nla_get_u32(data[IFLA_BOND_ARP_INTERVAL]);
165
166                 if (arp_interval && miimon) {
167                         pr_err("%s: ARP monitoring cannot be used with MII monitoring.\n",
168                                bond->dev->name);
169                         return -EINVAL;
170                 }
171
172                 bond_opt_initval(&newval, arp_interval);
173                 err = __bond_opt_set(bond, BOND_OPT_ARP_INTERVAL, &newval);
174                 if (err)
175                         return err;
176         }
177         if (data[IFLA_BOND_ARP_IP_TARGET]) {
178                 struct nlattr *attr;
179                 int i = 0, rem;
180
181                 bond_option_arp_ip_targets_clear(bond);
182                 nla_for_each_nested(attr, data[IFLA_BOND_ARP_IP_TARGET], rem) {
183                         __be32 target = nla_get_be32(attr);
184
185                         bond_opt_initval(&newval, target);
186                         err = __bond_opt_set(bond, BOND_OPT_ARP_TARGETS,
187                                              &newval);
188                         if (err)
189                                 break;
190                         i++;
191                 }
192                 if (i == 0 && bond->params.arp_interval)
193                         pr_warn("%s: removing last arp target with arp_interval on\n",
194                                 bond->dev->name);
195                 if (err)
196                         return err;
197         }
198         if (data[IFLA_BOND_ARP_VALIDATE]) {
199                 int arp_validate = nla_get_u32(data[IFLA_BOND_ARP_VALIDATE]);
200
201                 if (arp_validate && miimon) {
202                         pr_err("%s: ARP validating cannot be used with MII monitoring.\n",
203                                bond->dev->name);
204                         return -EINVAL;
205                 }
206
207                 bond_opt_initval(&newval, arp_validate);
208                 err = __bond_opt_set(bond, BOND_OPT_ARP_VALIDATE, &newval);
209                 if (err)
210                         return err;
211         }
212         if (data[IFLA_BOND_ARP_ALL_TARGETS]) {
213                 int arp_all_targets =
214                         nla_get_u32(data[IFLA_BOND_ARP_ALL_TARGETS]);
215
216                 bond_opt_initval(&newval, arp_all_targets);
217                 err = __bond_opt_set(bond, BOND_OPT_ARP_ALL_TARGETS, &newval);
218                 if (err)
219                         return err;
220         }
221         if (data[IFLA_BOND_PRIMARY]) {
222                 int ifindex = nla_get_u32(data[IFLA_BOND_PRIMARY]);
223                 struct net_device *dev;
224                 char *primary = "";
225
226                 dev = __dev_get_by_index(dev_net(bond_dev), ifindex);
227                 if (dev)
228                         primary = dev->name;
229
230                 bond_opt_initstr(&newval, primary);
231                 err = __bond_opt_set(bond, BOND_OPT_PRIMARY, &newval);
232                 if (err)
233                         return err;
234         }
235         if (data[IFLA_BOND_PRIMARY_RESELECT]) {
236                 int primary_reselect =
237                         nla_get_u8(data[IFLA_BOND_PRIMARY_RESELECT]);
238
239                 err = bond_option_primary_reselect_set(bond, primary_reselect);
240                 if (err)
241                         return err;
242         }
243         if (data[IFLA_BOND_FAIL_OVER_MAC]) {
244                 int fail_over_mac =
245                         nla_get_u8(data[IFLA_BOND_FAIL_OVER_MAC]);
246
247                 bond_opt_initval(&newval, fail_over_mac);
248                 err = __bond_opt_set(bond, BOND_OPT_FAIL_OVER_MAC, &newval);
249                 if (err)
250                         return err;
251         }
252         if (data[IFLA_BOND_XMIT_HASH_POLICY]) {
253                 int xmit_hash_policy =
254                         nla_get_u8(data[IFLA_BOND_XMIT_HASH_POLICY]);
255
256                 bond_opt_initval(&newval, xmit_hash_policy);
257                 err = __bond_opt_set(bond, BOND_OPT_XMIT_HASH, &newval);
258                 if (err)
259                         return err;
260         }
261         if (data[IFLA_BOND_RESEND_IGMP]) {
262                 int resend_igmp =
263                         nla_get_u32(data[IFLA_BOND_RESEND_IGMP]);
264
265                 err = bond_option_resend_igmp_set(bond, resend_igmp);
266                 if (err)
267                         return err;
268         }
269         if (data[IFLA_BOND_NUM_PEER_NOTIF]) {
270                 int num_peer_notif =
271                         nla_get_u8(data[IFLA_BOND_NUM_PEER_NOTIF]);
272
273                 bond_opt_initval(&newval, num_peer_notif);
274                 err = __bond_opt_set(bond, BOND_OPT_NUM_PEER_NOTIF, &newval);
275                 if (err)
276                         return err;
277         }
278         if (data[IFLA_BOND_ALL_SLAVES_ACTIVE]) {
279                 int all_slaves_active =
280                         nla_get_u8(data[IFLA_BOND_ALL_SLAVES_ACTIVE]);
281
282                 err = bond_option_all_slaves_active_set(bond,
283                                                         all_slaves_active);
284                 if (err)
285                         return err;
286         }
287         if (data[IFLA_BOND_MIN_LINKS]) {
288                 int min_links =
289                         nla_get_u32(data[IFLA_BOND_MIN_LINKS]);
290
291                 bond_opt_initval(&newval, min_links);
292                 err = __bond_opt_set(bond, BOND_OPT_MINLINKS, &newval);
293                 if (err)
294                         return err;
295         }
296         if (data[IFLA_BOND_LP_INTERVAL]) {
297                 int lp_interval =
298                         nla_get_u32(data[IFLA_BOND_LP_INTERVAL]);
299
300                 err = bond_option_lp_interval_set(bond, lp_interval);
301                 if (err)
302                         return err;
303         }
304         if (data[IFLA_BOND_PACKETS_PER_SLAVE]) {
305                 int packets_per_slave =
306                         nla_get_u32(data[IFLA_BOND_PACKETS_PER_SLAVE]);
307
308                 bond_opt_initval(&newval, packets_per_slave);
309                 err = __bond_opt_set(bond, BOND_OPT_PACKETS_PER_SLAVE, &newval);
310                 if (err)
311                         return err;
312         }
313         if (data[IFLA_BOND_AD_LACP_RATE]) {
314                 int lacp_rate =
315                         nla_get_u8(data[IFLA_BOND_AD_LACP_RATE]);
316
317                 bond_opt_initval(&newval, lacp_rate);
318                 err = __bond_opt_set(bond, BOND_OPT_LACP_RATE, &newval);
319                 if (err)
320                         return err;
321         }
322         if (data[IFLA_BOND_AD_SELECT]) {
323                 int ad_select =
324                         nla_get_u8(data[IFLA_BOND_AD_SELECT]);
325
326                 bond_opt_initval(&newval, ad_select);
327                 err = __bond_opt_set(bond, BOND_OPT_AD_SELECT, &newval);
328                 if (err)
329                         return err;
330         }
331         return 0;
332 }
333
334 static int bond_newlink(struct net *src_net, struct net_device *bond_dev,
335                         struct nlattr *tb[], struct nlattr *data[])
336 {
337         int err;
338
339         err = bond_changelink(bond_dev, tb, data);
340         if (err < 0)
341                 return err;
342
343         return register_netdevice(bond_dev);
344 }
345
346 static size_t bond_get_size(const struct net_device *bond_dev)
347 {
348         return nla_total_size(sizeof(u8)) +     /* IFLA_BOND_MODE */
349                 nla_total_size(sizeof(u32)) +   /* IFLA_BOND_ACTIVE_SLAVE */
350                 nla_total_size(sizeof(u32)) +   /* IFLA_BOND_MIIMON */
351                 nla_total_size(sizeof(u32)) +   /* IFLA_BOND_UPDELAY */
352                 nla_total_size(sizeof(u32)) +   /* IFLA_BOND_DOWNDELAY */
353                 nla_total_size(sizeof(u8)) +    /* IFLA_BOND_USE_CARRIER */
354                 nla_total_size(sizeof(u32)) +   /* IFLA_BOND_ARP_INTERVAL */
355                                                 /* IFLA_BOND_ARP_IP_TARGET */
356                 nla_total_size(sizeof(struct nlattr)) +
357                 nla_total_size(sizeof(u32)) * BOND_MAX_ARP_TARGETS +
358                 nla_total_size(sizeof(u32)) +   /* IFLA_BOND_ARP_VALIDATE */
359                 nla_total_size(sizeof(u32)) +   /* IFLA_BOND_ARP_ALL_TARGETS */
360                 nla_total_size(sizeof(u32)) +   /* IFLA_BOND_PRIMARY */
361                 nla_total_size(sizeof(u8)) +    /* IFLA_BOND_PRIMARY_RESELECT */
362                 nla_total_size(sizeof(u8)) +    /* IFLA_BOND_FAIL_OVER_MAC */
363                 nla_total_size(sizeof(u8)) +    /* IFLA_BOND_XMIT_HASH_POLICY */
364                 nla_total_size(sizeof(u32)) +   /* IFLA_BOND_RESEND_IGMP */
365                 nla_total_size(sizeof(u8)) +    /* IFLA_BOND_NUM_PEER_NOTIF */
366                 nla_total_size(sizeof(u8)) +   /* IFLA_BOND_ALL_SLAVES_ACTIVE */
367                 nla_total_size(sizeof(u32)) +   /* IFLA_BOND_MIN_LINKS */
368                 nla_total_size(sizeof(u32)) +   /* IFLA_BOND_LP_INTERVAL */
369                 nla_total_size(sizeof(u32)) +  /* IFLA_BOND_PACKETS_PER_SLAVE */
370                 nla_total_size(sizeof(u8)) +    /* IFLA_BOND_AD_LACP_RATE */
371                 nla_total_size(sizeof(u8)) +    /* IFLA_BOND_AD_SELECT */
372                 nla_total_size(sizeof(struct nlattr)) + /* IFLA_BOND_AD_INFO */
373                 nla_total_size(sizeof(u16)) + /* IFLA_BOND_AD_INFO_AGGREGATOR */
374                 nla_total_size(sizeof(u16)) + /* IFLA_BOND_AD_INFO_NUM_PORTS */
375                 nla_total_size(sizeof(u16)) + /* IFLA_BOND_AD_INFO_ACTOR_KEY */
376                 nla_total_size(sizeof(u16)) + /* IFLA_BOND_AD_INFO_PARTNER_KEY*/
377                 nla_total_size(ETH_ALEN) +    /* IFLA_BOND_AD_INFO_PARTNER_MAC*/
378                 0;
379 }
380
381 static int bond_fill_info(struct sk_buff *skb,
382                           const struct net_device *bond_dev)
383 {
384         struct bonding *bond = netdev_priv(bond_dev);
385         struct net_device *slave_dev = bond_option_active_slave_get(bond);
386         struct nlattr *targets;
387         unsigned int packets_per_slave;
388         int i, targets_added;
389
390         if (nla_put_u8(skb, IFLA_BOND_MODE, bond->params.mode))
391                 goto nla_put_failure;
392
393         if (slave_dev &&
394             nla_put_u32(skb, IFLA_BOND_ACTIVE_SLAVE, slave_dev->ifindex))
395                 goto nla_put_failure;
396
397         if (nla_put_u32(skb, IFLA_BOND_MIIMON, bond->params.miimon))
398                 goto nla_put_failure;
399
400         if (nla_put_u32(skb, IFLA_BOND_UPDELAY,
401                         bond->params.updelay * bond->params.miimon))
402                 goto nla_put_failure;
403
404         if (nla_put_u32(skb, IFLA_BOND_DOWNDELAY,
405                         bond->params.downdelay * bond->params.miimon))
406                 goto nla_put_failure;
407
408         if (nla_put_u8(skb, IFLA_BOND_USE_CARRIER, bond->params.use_carrier))
409                 goto nla_put_failure;
410
411         if (nla_put_u32(skb, IFLA_BOND_ARP_INTERVAL, bond->params.arp_interval))
412                 goto nla_put_failure;
413
414         targets = nla_nest_start(skb, IFLA_BOND_ARP_IP_TARGET);
415         if (!targets)
416                 goto nla_put_failure;
417
418         targets_added = 0;
419         for (i = 0; i < BOND_MAX_ARP_TARGETS; i++) {
420                 if (bond->params.arp_targets[i]) {
421                         nla_put_be32(skb, i, bond->params.arp_targets[i]);
422                         targets_added = 1;
423                 }
424         }
425
426         if (targets_added)
427                 nla_nest_end(skb, targets);
428         else
429                 nla_nest_cancel(skb, targets);
430
431         if (nla_put_u32(skb, IFLA_BOND_ARP_VALIDATE, bond->params.arp_validate))
432                 goto nla_put_failure;
433
434         if (nla_put_u32(skb, IFLA_BOND_ARP_ALL_TARGETS,
435                         bond->params.arp_all_targets))
436                 goto nla_put_failure;
437
438         if (bond->primary_slave &&
439             nla_put_u32(skb, IFLA_BOND_PRIMARY,
440                         bond->primary_slave->dev->ifindex))
441                 goto nla_put_failure;
442
443         if (nla_put_u8(skb, IFLA_BOND_PRIMARY_RESELECT,
444                        bond->params.primary_reselect))
445                 goto nla_put_failure;
446
447         if (nla_put_u8(skb, IFLA_BOND_FAIL_OVER_MAC,
448                        bond->params.fail_over_mac))
449                 goto nla_put_failure;
450
451         if (nla_put_u8(skb, IFLA_BOND_XMIT_HASH_POLICY,
452                        bond->params.xmit_policy))
453                 goto nla_put_failure;
454
455         if (nla_put_u32(skb, IFLA_BOND_RESEND_IGMP,
456                         bond->params.resend_igmp))
457                 goto nla_put_failure;
458
459         if (nla_put_u8(skb, IFLA_BOND_NUM_PEER_NOTIF,
460                        bond->params.num_peer_notif))
461                 goto nla_put_failure;
462
463         if (nla_put_u8(skb, IFLA_BOND_ALL_SLAVES_ACTIVE,
464                        bond->params.all_slaves_active))
465                 goto nla_put_failure;
466
467         if (nla_put_u32(skb, IFLA_BOND_MIN_LINKS,
468                         bond->params.min_links))
469                 goto nla_put_failure;
470
471         if (nla_put_u32(skb, IFLA_BOND_LP_INTERVAL,
472                         bond->params.lp_interval))
473                 goto nla_put_failure;
474
475         packets_per_slave = bond->params.packets_per_slave;
476         if (nla_put_u32(skb, IFLA_BOND_PACKETS_PER_SLAVE,
477                         packets_per_slave))
478                 goto nla_put_failure;
479
480         if (nla_put_u8(skb, IFLA_BOND_AD_LACP_RATE,
481                        bond->params.lacp_fast))
482                 goto nla_put_failure;
483
484         if (nla_put_u8(skb, IFLA_BOND_AD_SELECT,
485                        bond->params.ad_select))
486                 goto nla_put_failure;
487
488         if (bond->params.mode == BOND_MODE_8023AD) {
489                 struct ad_info info;
490
491                 if (!bond_3ad_get_active_agg_info(bond, &info)) {
492                         struct nlattr *nest;
493
494                         nest = nla_nest_start(skb, IFLA_BOND_AD_INFO);
495                         if (!nest)
496                                 goto nla_put_failure;
497
498                         if (nla_put_u16(skb, IFLA_BOND_AD_INFO_AGGREGATOR,
499                                         info.aggregator_id))
500                                 goto nla_put_failure;
501                         if (nla_put_u16(skb, IFLA_BOND_AD_INFO_NUM_PORTS,
502                                         info.ports))
503                                 goto nla_put_failure;
504                         if (nla_put_u16(skb, IFLA_BOND_AD_INFO_ACTOR_KEY,
505                                         info.actor_key))
506                                 goto nla_put_failure;
507                         if (nla_put_u16(skb, IFLA_BOND_AD_INFO_PARTNER_KEY,
508                                         info.partner_key))
509                                 goto nla_put_failure;
510                         if (nla_put(skb, IFLA_BOND_AD_INFO_PARTNER_MAC,
511                                     sizeof(info.partner_system),
512                                     &info.partner_system))
513                                 goto nla_put_failure;
514
515                         nla_nest_end(skb, nest);
516                 }
517         }
518
519         return 0;
520
521 nla_put_failure:
522         return -EMSGSIZE;
523 }
524
525 struct rtnl_link_ops bond_link_ops __read_mostly = {
526         .kind                   = "bond",
527         .priv_size              = sizeof(struct bonding),
528         .setup                  = bond_setup,
529         .maxtype                = IFLA_BOND_MAX,
530         .policy                 = bond_policy,
531         .validate               = bond_validate,
532         .newlink                = bond_newlink,
533         .changelink             = bond_changelink,
534         .get_size               = bond_get_size,
535         .fill_info              = bond_fill_info,
536         .get_num_tx_queues      = bond_get_num_tx_queues,
537         .get_num_rx_queues      = bond_get_num_tx_queues, /* Use the same number
538                                                              as for TX queues */
539 };
540
541 int __init bond_netlink_init(void)
542 {
543         return rtnl_link_register(&bond_link_ops);
544 }
545
546 void bond_netlink_fini(void)
547 {
548         rtnl_link_unregister(&bond_link_ops);
549 }
550
551 MODULE_ALIAS_RTNL_LINK("bond");