Bug 131536

Summary: [netinet] [patch] kernel does allow manipulation of subnet routes
Product: Base System Reporter: roy
Component: kernAssignee: Andre Oppermann <andre>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.shar none

Description roy 2009-02-09 17:10:01 UTC
When manipulating the automatically added kernel route, the IFA_ROUTE
flag incorrectly remains on the interface address.

Also, if no IA has the IFA_ROUTE flag and a connected route already
exists it should not be an error assigning the address.

This affects all BSD and was discussed at NetBSD here
http://mail-index.netbsd.org/tech-net/2008/12/03/msg000896.html
and patch commited here
http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=40133

Fix: Attached shar contains two patches, cut against FreeBSD-7.1

Patch attached with submission follows:
How-To-Repeat: This shell script demonstrates the problem

#!/bin/sh -x

nw=192.168.1.0
nm=24
ifp1=bge0
ifa1=192.168.1.10
ifp2=iwi0
ifa2=192.168.1.20
snr=192.168.1.0

# Configure ifa's
ifconfig $ifp1 alias $ifa1/$nm
ifconfig $ifp2 alias $ifa2/$nm

# Connect ifp2
route change $nw/$nm -ifp $ifp2

# Remove and then add ifa1. The add should fail - this is a bug.
ifconfig $ifp1 -alias $ifa1
ifconfig $ifp1 alias $ifa1/$nm
ifconfig $ifp1

# Remove all aliases now
route delete $nw/$nm
ifconfig $ifp1 -alias $ifa1
ifconfig $ifp2 -alias $ifa2
Comment 1 Gavin Atkinson freebsd_committer freebsd_triage 2009-02-10 13:40:47 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-net

Over to maintainer(s)
Comment 2 Andre Oppermann freebsd_committer freebsd_triage 2010-08-10 23:24:08 UTC
Responsible Changed
From-To: freebsd-net->andre

Take over.
Comment 3 roy 2014-10-20 13:59:02 UTC
I've not tested if this specific use case remains, but my need to add/delete IPv4 routes has since been fixed in FreeBSD as net/dhcpcd-6.5.1 demonstrates :)