updating a routing table entry
Mike Tancsa
mike at sentex.net
Mon Jun 16 18:27:03 PDT 2003
I am trying to work around a problem, where a routing daemon (zebra)
installs a subnet, that I then want to convert over to a connected route
off an interface via ifconfig
e.g. on vlan2 I want to add an interface on the subnet 12.0.0.112/28.
Before the ifconfig I see
# route get 12.0.0.112/28
route to: 12.0.0.112
destination: 12.0.0.112
mask: 255.255.255.240
gateway: 192.168.1.1
interface: vlan1
flags: <UP,GATEWAY,DONE,PROTO1,PRCLONING>
recvpipe sendpipe ssthresh rtt,msec rttvar hopcount mtu
expire
0 0 0 0 0 0 1500
0
In the case of the 12.0.0.112/28 network I guess i need to get the kernel
and zebra to know that its not
flags: <UP,GATEWAY,DONE,PROTO1,PRCLONING>
but
flags: <UP,DONE,CLONING>
and via vlan2
Short of killing the routing daemon, doing the ifconfig, is there another
way to do this ?
What about some ifconfig hackery ? Is this not where it dies ?
if (newaddr && (setaddr || setmask)) {
strncpy(afp->af_addreq, name, sizeof ifr.ifr_name);
if (ioctl(s, afp->af_aifaddr, afp->af_addreq) < 0)
Perror("ioctl (SIOCAIFADDR)");
}
What if I added a check for a flag/param (e.g. -force)
if (newaddr && (setaddr || setmask) && !FORCE ) {
strncpy(afp->af_addreq, name, sizeof ifr.ifr_name);
if (ioctl(s, afp->af_aifaddr, afp->af_addreq) < 0)
Perror("ioctl (SIOCAIFADDR)");
}
Is there a better way to do it ?
---Mike
--------------------------------------------------------------------
Mike Tancsa, tel +1 519 651 3400
Sentex Communications, mike at sentex.net
Providing Internet since 1994 www.sentex.net
Cambridge, Ontario Canada www.sentex.net/mike
More information about the freebsd-hackers
mailing list