@@ -1242,10 +1242,28 @@ static bool slave_can_set_ns_maddr(const struct bonding *bond, struct slave *sla
1242
1242
slave -> dev -> flags & IFF_MULTICAST ;
1243
1243
}
1244
1244
1245
+ /**
1246
+ * slave_set_ns_maddrs - add/del all NS mac addresses for slave
1247
+ * @bond: bond device
1248
+ * @slave: slave device
1249
+ * @add: add or remove all the NS mac addresses
1250
+ *
1251
+ * This function tries to add or delete all the NS mac addresses on the slave
1252
+ *
1253
+ * Note, the IPv6 NS target address is the unicast address in Neighbor
1254
+ * Solicitation (NS) message. The dest address of NS message should be
1255
+ * solicited-node multicast address of the target. The dest mac of NS message
1256
+ * is converted from the solicited-node multicast address.
1257
+ *
1258
+ * This function is called when
1259
+ * * arp_validate changes
1260
+ * * enslaving, releasing new slaves
1261
+ */
1245
1262
static void slave_set_ns_maddrs (struct bonding * bond , struct slave * slave , bool add )
1246
1263
{
1247
1264
struct in6_addr * targets = bond -> params .ns_targets ;
1248
1265
char slot_maddr [MAX_ADDR_LEN ];
1266
+ struct in6_addr mcaddr ;
1249
1267
int i ;
1250
1268
1251
1269
if (!slave_can_set_ns_maddr (bond , slave ))
@@ -1255,7 +1273,8 @@ static void slave_set_ns_maddrs(struct bonding *bond, struct slave *slave, bool
1255
1273
if (ipv6_addr_any (& targets [i ]))
1256
1274
break ;
1257
1275
1258
- if (!ndisc_mc_map (& targets [i ], slot_maddr , slave -> dev , 0 )) {
1276
+ addrconf_addr_solict_mult (& targets [i ], & mcaddr );
1277
+ if (!ndisc_mc_map (& mcaddr , slot_maddr , slave -> dev , 0 )) {
1259
1278
if (add )
1260
1279
dev_mc_add (slave -> dev , slot_maddr );
1261
1280
else
@@ -1278,23 +1297,43 @@ void bond_slave_ns_maddrs_del(struct bonding *bond, struct slave *slave)
1278
1297
slave_set_ns_maddrs (bond , slave , false);
1279
1298
}
1280
1299
1300
+ /**
1301
+ * slave_set_ns_maddr - set new NS mac address for slave
1302
+ * @bond: bond device
1303
+ * @slave: slave device
1304
+ * @target: the new IPv6 target
1305
+ * @slot: the old IPv6 target in the slot
1306
+ *
1307
+ * This function tries to replace the old mac address to new one on the slave.
1308
+ *
1309
+ * Note, the target/slot IPv6 address is the unicast address in Neighbor
1310
+ * Solicitation (NS) message. The dest address of NS message should be
1311
+ * solicited-node multicast address of the target. The dest mac of NS message
1312
+ * is converted from the solicited-node multicast address.
1313
+ *
1314
+ * This function is called when
1315
+ * * An IPv6 NS target is added or removed.
1316
+ */
1281
1317
static void slave_set_ns_maddr (struct bonding * bond , struct slave * slave ,
1282
1318
struct in6_addr * target , struct in6_addr * slot )
1283
1319
{
1284
- char target_maddr [MAX_ADDR_LEN ], slot_maddr [MAX_ADDR_LEN ];
1320
+ char mac_addr [MAX_ADDR_LEN ];
1321
+ struct in6_addr mcast_addr ;
1285
1322
1286
1323
if (!bond -> params .arp_validate || !slave_can_set_ns_maddr (bond , slave ))
1287
1324
return ;
1288
1325
1289
- /* remove the previous maddr from slave */
1326
+ /* remove the previous mac addr from slave */
1327
+ addrconf_addr_solict_mult (slot , & mcast_addr );
1290
1328
if (!ipv6_addr_any (slot ) &&
1291
- !ndisc_mc_map (slot , slot_maddr , slave -> dev , 0 ))
1292
- dev_mc_del (slave -> dev , slot_maddr );
1329
+ !ndisc_mc_map (& mcast_addr , mac_addr , slave -> dev , 0 ))
1330
+ dev_mc_del (slave -> dev , mac_addr );
1293
1331
1294
- /* add new maddr on slave if target is set */
1332
+ /* add new mac addr on slave if target is set */
1333
+ addrconf_addr_solict_mult (target , & mcast_addr );
1295
1334
if (!ipv6_addr_any (target ) &&
1296
- !ndisc_mc_map (target , target_maddr , slave -> dev , 0 ))
1297
- dev_mc_add (slave -> dev , target_maddr );
1335
+ !ndisc_mc_map (& mcast_addr , mac_addr , slave -> dev , 0 ))
1336
+ dev_mc_add (slave -> dev , mac_addr );
1298
1337
}
1299
1338
1300
1339
static void _bond_options_ns_ip6_target_set (struct bonding * bond , int slot ,
0 commit comments