@@ -28,6 +28,7 @@ ALL_TESTS="
2828 kci_test_fdb_get
2929 kci_test_fdb_del
3030 kci_test_neigh_get
31+ kci_test_neigh_update
3132 kci_test_bridge_parent_id
3233 kci_test_address_proto
3334 kci_test_enslave_bonding
@@ -1160,6 +1161,60 @@ kci_test_neigh_get()
11601161 end_test " PASS: neigh get"
11611162}
11621163
1164+ kci_test_neigh_update ()
1165+ {
1166+ dstip=10.0.2.4
1167+ dstmac=de:ad:be:ef:13:37
1168+ local ret=0
1169+
1170+ for proxy in " " " proxy" ; do
1171+ # add a neighbour entry without any flags
1172+ run_cmd ip neigh add $proxy $dstip dev " $devdummy " lladdr $dstmac nud permanent
1173+ run_cmd_grep $dstip ip neigh show $proxy
1174+ run_cmd_grep_fail " $dstip dev $devdummy .*\(managed\|use\|router\|extern\)" ip neigh show $proxy
1175+
1176+ # set the extern_learn flag, but no other
1177+ run_cmd ip neigh change $proxy $dstip dev " $devdummy " extern_learn
1178+ run_cmd_grep " $dstip dev $devdummy .* extern_learn" ip neigh show $proxy
1179+ run_cmd_grep_fail " $dstip dev $devdummy .* \(managed\|use\|router\)" ip neigh show $proxy
1180+
1181+ # flags are reset when not provided
1182+ run_cmd ip neigh change $proxy $dstip dev " $devdummy "
1183+ run_cmd_grep $dstip ip neigh show $proxy
1184+ run_cmd_grep_fail " $dstip dev $devdummy .* extern_learn" ip neigh show $proxy
1185+
1186+ # add a protocol
1187+ run_cmd ip neigh change $proxy $dstip dev " $devdummy " protocol boot
1188+ run_cmd_grep " $dstip dev $devdummy .* proto boot" ip neigh show $proxy
1189+
1190+ # protocol is retained when not provided
1191+ run_cmd ip neigh change $proxy $dstip dev " $devdummy "
1192+ run_cmd_grep " $dstip dev $devdummy .* proto boot" ip neigh show $proxy
1193+
1194+ # change protocol
1195+ run_cmd ip neigh change $proxy $dstip dev " $devdummy " protocol static
1196+ run_cmd_grep " $dstip dev $devdummy .* proto static" ip neigh show $proxy
1197+
1198+ # also check an extended flag for non-proxy neighs
1199+ if [ " $proxy " = " " ]; then
1200+ run_cmd ip neigh change $proxy $dstip dev " $devdummy " managed
1201+ run_cmd_grep " $dstip dev $devdummy managed" ip neigh show $proxy
1202+
1203+ run_cmd ip neigh change $proxy $dstip dev " $devdummy " lladdr $dstmac
1204+ run_cmd_grep_fail " $dstip dev $devdummy managed" ip neigh show $proxy
1205+ fi
1206+
1207+ run_cmd ip neigh del $proxy $dstip dev " $devdummy "
1208+ done
1209+
1210+ if [ $ret -ne 0 ]; then
1211+ end_test " FAIL: neigh update"
1212+ return 1
1213+ fi
1214+
1215+ end_test " PASS: neigh update"
1216+ }
1217+
11631218kci_test_bridge_parent_id ()
11641219{
11651220 local ret=0
0 commit comments