View | Details | Raw Unified | Return to bug 189089
Collapse All | Expand All

(-)sys/netinet/in.c (-3 / +7 lines)
Lines 696-706 Link Here
696
{
696
{
697
	struct in_ifaddr *ia;
697
	struct in_ifaddr *ia;
698
	struct in_addr prefix, mask, p, m;
698
	struct in_addr prefix, mask, p, m;
699
	int error = 0, fibnum;
699
	int error = 0;
700
	struct sockaddr_in prefix0, mask0;
700
	struct sockaddr_in prefix0, mask0;
701
701
702
	fibnum = rt_add_addr_allfibs ? RT_ALL_FIBS : target->ia_ifp->if_fib;
703
704
	/*
702
	/*
705
	 * Remove the loopback route to the interface address.
703
	 * Remove the loopback route to the interface address.
706
	 */
704
	 */
Lines 712-717 Link Here
712
		eia = in_localip_more(target);
710
		eia = in_localip_more(target);
713
711
714
		if (eia != NULL) {
712
		if (eia != NULL) {
713
			int fibnum = target->ia_ifp->if_fib;
714
715
			error = ifa_switch_loopback_route((struct ifaddr *)eia,
715
			error = ifa_switch_loopback_route((struct ifaddr *)eia,
716
			    (struct sockaddr *)&target->ia_addr, fibnum);
716
			    (struct sockaddr *)&target->ia_addr, fibnum);
717
			ifa_free(&eia->ia_ifa);
717
			ifa_free(&eia->ia_ifa);
Lines 736-741 Link Here
736
	}
736
	}
737
737
738
	if ((target->ia_flags & IFA_ROUTE) == 0) {
738
	if ((target->ia_flags & IFA_ROUTE) == 0) {
739
		int fibnum;
740
		
741
		fibnum = rt_add_addr_allfibs ? RT_ALL_FIBS :
742
			target->ia_ifp->if_fib;
739
		rt_addrmsg(RTM_DELETE, &target->ia_ifa, fibnum);
743
		rt_addrmsg(RTM_DELETE, &target->ia_ifa, fibnum);
740
		return (0);
744
		return (0);
741
	}
745
	}
(-)tests/sys/netinet/fibs_test.sh (+40 lines)
Lines 213-218 Link Here
213
}
213
}
214
214
215
215
216
# Regression test for a panic introduced in change 264887
217
# Create two tap interfaces and assign them both the same IP address but with
218
# different netmasks, and both on the default FIB.  Then remove one's IP
219
# address.  Hopefully the machine won't panic.
220
atf_test_case same_ip_multiple_ifaces_fib0 cleanup
221
same_ip_multiple_ifaces_fib0_head()
222
{
223
	atf_set "descr" "Can remove an IP alias from an interface when the same IP is also assigned to another interface."
224
	atf_set "require.user" "root"
225
	atf_set "require.config" "fibs"
226
}
227
same_ip_multiple_ifaces_fib0_body()
228
{
229
	ADDR="192.0.2.2"
230
	MASK0="24"
231
	MASK1="32"
232
233
	# Unlike most of the tests in this file, this is applicable regardless
234
	# of net.add_addr_allfibs
235
236
	# Setup the interfaces, then remove one alias.  It should not panic.
237
	setup_tap 0 ${ADDR} ${MASK0}
238
	TAP0=${TAP}
239
	setup_tap 0 ${ADDR} ${MASK1}
240
	TAP1=${TAP}
241
	ifconfig ${TAP1} -alias ${ADDR}
242
243
	# Do it again, in the opposite order.  It should not panic.
244
	setup_tap 0 ${ADDR} ${MASK0}
245
	TAP0=${TAP}
246
	setup_tap 0 ${ADDR} ${MASK1}
247
	TAP1=${TAP}
248
	ifconfig ${TAP0} -alias ${ADDR}
249
}
250
same_ip_multiple_ifaces_fib0_cleanup()
251
{
252
	cleanup_tap
253
}
254
216
# Regression test for kern/187550
255
# Regression test for kern/187550
217
atf_test_case subnet_route_with_multiple_fibs_on_same_subnet cleanup
256
atf_test_case subnet_route_with_multiple_fibs_on_same_subnet cleanup
218
subnet_route_with_multiple_fibs_on_same_subnet_head()
257
subnet_route_with_multiple_fibs_on_same_subnet_head()
Lines 309-314 Link Here
309
	atf_add_test_case arpresolve_checks_interface_fib
348
	atf_add_test_case arpresolve_checks_interface_fib
310
	atf_add_test_case loopback_and_network_routes_on_nondefault_fib
349
	atf_add_test_case loopback_and_network_routes_on_nondefault_fib
311
	atf_add_test_case default_route_with_multiple_fibs_on_same_subnet
350
	atf_add_test_case default_route_with_multiple_fibs_on_same_subnet
351
	atf_add_test_case same_ip_multiple_ifaces_fib0
312
	atf_add_test_case subnet_route_with_multiple_fibs_on_same_subnet
352
	atf_add_test_case subnet_route_with_multiple_fibs_on_same_subnet
313
	atf_add_test_case udp_dontroute
353
	atf_add_test_case udp_dontroute
314
}
354
}

Return to bug 189089