Discussion:
route change addr -ifp foo behaviour
(too old to reply)
Roy Marples
2009-03-03 20:36:03 UTC
Permalink
Hi List!

ifconfig re0 alias 192.168.0.1/24 #re0 gets the connected route
ifconfig re1 alias 192.168.0.2/24

Now, we want to change the connected route to re1

route change 192.168.0.0/24 -ifa 192.168.0.2
route change 192.168.0.0/24 -ifp re1 -ifa 192.168.0.2
route change 192.168.0.0/24 -ifp re1

What is the *expected* behaviour of the above three commands?
I ask because in my mind they are equivalent when there is only one INET
address on the interface, but the real world results are different.

ifconfig re0 -alias 192.168.0.1 # connected route remains, ok
ifconfig re1 -alias 192.168.0.2

Now, if the last route style command is used, the last ifconfig command
will not remove the connected route. If the other two where used (ifa
specified) then the connected route is removed.

I've read the man page, and it's implied that -ifp should be used if
-ifa is ambiguous but doesn't say what the effect is if used without
-ifa.

Comments?

Thanks

Roy
David Young
2009-03-05 19:17:57 UTC
Permalink
Post by Roy Marples
Hi List!
ifconfig re0 alias 192.168.0.1/24 #re0 gets the connected route
ifconfig re1 alias 192.168.0.2/24
Now, we want to change the connected route to re1
route change 192.168.0.0/24 -ifa 192.168.0.2
route change 192.168.0.0/24 -ifp re1 -ifa 192.168.0.2
route change 192.168.0.0/24 -ifp re1
What is the *expected* behaviour of the above three commands?
I ask because in my mind they are equivalent when there is only one INET
address on the interface, but the real world results are different.
route change 192.168.0.0/24 -ifa 192.168.0.2
Use the source address 192.168.0.2 for traffic originating from
this host with destination 192.168.0.0/24.
Post by Roy Marples
route change 192.168.0.0/24 -ifp re1 -ifa 192.168.0.2
Use the source address 192.168.0.2 for traffic originating from
this host with destination 192.168.0.0/24; reach said destination
through re1.
Post by Roy Marples
route change 192.168.0.0/24 -ifp re1
Reach destination 192.168.0.0/24 through re1.
Post by Roy Marples
ifconfig re0 -alias 192.168.0.1 # connected route remains, ok
ifconfig re1 -alias 192.168.0.2
Now, if the last route style command is used, the last ifconfig command
will not remove the connected route. If the other two where used (ifa
specified) then the connected route is removed.
I don't know what to make of that. It would help if you
would send relevant 'route show' or 'netstat -rn -f inet'
output at each step, so that readers don't have to try to reproduce
these steps on their own.

Dave
--
David Young OJC Technologies
***@ojctech.com Urbana, IL * (217) 278-3933

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Roy Marples
2009-03-06 00:16:49 UTC
Permalink
Post by David Young
Post by Roy Marples
route change 192.168.0.0/24 -ifp re1
Reach destination 192.168.0.0/24 through re1.
This is the case which I'm interested in.
At this point it becomes a managed route, so whilst dropping the
IFA_ROUTE flag is correct, we should not add it to the sockaddr_dl ifa.
Post by David Young
Post by Roy Marples
ifconfig re0 -alias 192.168.0.1 # connected route remains, ok
ifconfig re1 -alias 192.168.0.2
Now, if the last route style command is used, the last ifconfig command
will not remove the connected route. If the other two where used (ifa
specified) then the connected route is removed.
I don't know what to make of that. It would help if you
would send relevant 'route show' or 'netstat -rn -f inet'
output at each step, so that readers don't have to try to reproduce
these steps on their own.
Output for both is actually the same.

I think I have the gist of the intent and expected behaviour now.
The patch will be adjusted accordingly.

Thanks

Roy
David Young
2009-03-06 01:44:44 UTC
Permalink
Post by Roy Marples
Post by David Young
Post by Roy Marples
route change 192.168.0.0/24 -ifp re1
Reach destination 192.168.0.0/24 through re1.
This is the case which I'm interested in.
At this point it becomes a managed route, so whilst dropping the
IFA_ROUTE flag is correct, we should not add it to the sockaddr_dl ifa.
The sockaddr_dl ifa?
Post by Roy Marples
Post by David Young
Post by Roy Marples
ifconfig re0 -alias 192.168.0.1 # connected route remains, ok
ifconfig re1 -alias 192.168.0.2
Now, if the last route style command is used, the last ifconfig command
will not remove the connected route. If the other two where used (ifa
specified) then the connected route is removed.
I don't know what to make of that. It would help if you
would send relevant 'route show' or 'netstat -rn -f inet'
output at each step, so that readers don't have to try to reproduce
these steps on their own.
Output for both is actually the same.
I think that you didn't understand what I am asking for. How do
those commands change the routing table? You've told us, but you
haven't shown us.

Dave
--
David Young OJC Technologies
***@ojctech.com Urbana, IL * (217) 278-3933

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Roy Marples
2009-03-06 15:09:03 UTC
Permalink
Post by David Young
Post by Roy Marples
Post by David Young
Post by Roy Marples
route change 192.168.0.0/24 -ifp re1
Reach destination 192.168.0.0/24 through re1.
This is the case which I'm interested in.
At this point it becomes a managed route, so whilst dropping the
IFA_ROUTE flag is correct, we should not add it to the sockaddr_dl ifa.
The sockaddr_dl ifa?
Well, the ifa it changes to isn't for the prefix route.
So let me prephrase slightly.

When you can an address and it generated an automatic subnet route, the
address is marked as IFA_ROUTE. If you then delete this address and
there is another address on the same prefix then the route remains and
the other address is marked as IFA_ROUTE.

But what happens when we manipulate the route instead of the address?
If the new ifa is the same prefix, should we mark the new ifa as
IFA_ROUTE? I think yes, and the patch did this.
If the new ifa is not on the same prefix, should we mark the new ifa as
IFA_ROUTE? I think no, but the patch did this as well and incorrectly
too.
If we add a new route and the ifa is the same prefix, should we mark the
ifa as IFA_ROUTE?
If we delete the prefix route, should we remove IFA_ROUTE from the ifa?
I think yes, but the patch did this regardless of prefix.

In a nutshell, I think that if a route changes ifa and the ifa is marked
IFA_ROUTE, the flag should be dropped if the route is the ifa prefix. If
the route is also the prefix for the new ifa then the ifa should be
marked IFA_ROUTE. Any other route manipulations should not touch
IFA_ROUTE. If the IFA_ROUTE flag is dropped as a result, then the
user/application that did this is responsible for managing the route.
Does this sound ok?

Sorry for all this, but I'm still trying to understand the intent of it.

Thanks

Roy

Loading...