Looks reasonable to add notification when ia6_flags is changed, but why is RTM_ADD used instead of RTM_CHANGE? rt_addrmsg() is for addition/removal of an address and RTM_ADD is translated to RTM_NEWADDR there.
Because rt_addrmsg() will change address announcements to RTM_DELADDR if not RTM_ADD. FreeBSD does not support RTM_CHGADDR so change doesn't really fit either. It can also be argued that the address itself, nor route, are actually changing, just the state of it.
For what its worth, NetBSD and Linux also use the same flags for this - RTM_NEWADDR or equivalent.
Let me clarify.
BSD uses rt_addrmsg() to announce new and deleted addresses.
It makes perfect sense to use the same function to announce address change states, such as for changes ia6_flags.
Because FreeBSD only has RTM_NEWADDR and RTM_DELADDR we need to use RTM_NEWADDR and the function arguments then dictate that we need to use RTM_ADD.
The alternative is to write a new function which doesn't take a route argument and thus can accept RTM_NEWADDR directly, but I thought that would be too much overhead for little gain.
ifam_flags is the interface flags so it makes sense to ignore it :)
This patch just enables the application to then ioctl SIOCGIFAFLAG_IN6 to get the state of the address when the address updates rather than polling perdiodically.
To really make this work we need ifam_addrflags ..... and ideally ifam_pid to identify the sender.