Date: Mon, 16 Jun 2003 21:25:01 -0400 From: Mike Tancsa <mike@sentex.net> To: hackers@freebsd.org Subject: updating a routing table entry Message-ID: <5.2.0.9.0.20030616210725.082e5240@192.168.0.12>
next in thread | raw e-mail | index | archive | help
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@sentex.net
Providing Internet since 1994 www.sentex.net
Cambridge, Ontario Canada www.sentex.net/mike
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5.2.0.9.0.20030616210725.082e5240>
