Changing IP causes "no route to host" errors

I have an application (using RTP 6.1) that must set the IP address and
netmask based on an externally read address. I’m changing them using
ioctl() and SIOCSIFADDR, SIOCSIFNETMASK, and SIOCSIFBRDADDR.

After I do this I can’t access the network. A ping returns
“ping: sendto: No route to host”

and route returns
“writing to routing socket: No such process”.

However, if I manually set the same IP and netmask using ifconfig
in a shell, everything works fine. There’s no differences in the processes
before and after that I can see.

What else is it that ifconfig does that I need to do? Must I also send
a SOCADDRT command?

Thanks for any help,
Jon

“Writing to routing socket:No such process” Indicates that io-net is
crashing.Something that you are writing with SIOC* ioctls is causing
it.Examine the io-net core and see where it has crashed…

Sreekanth

“Jon Wyatt” <jon.nospam.wyatt@removethis.ustraffic.net> wrote in message
news:b75cr9$gjt$1@inn.qnx.com

I have an application (using RTP 6.1) that must set the IP address and
netmask based on an externally read address. I’m changing them using
ioctl() and SIOCSIFADDR, SIOCSIFNETMASK, and SIOCSIFBRDADDR.

After I do this I can’t access the network. A ping returns
“ping: sendto: No route to host”

and route returns
“writing to routing socket: No such process”.

However, if I manually set the same IP and netmask using ifconfig
in a shell, everything works fine. There’s no differences in the
processes
before and after that I can see.

What else is it that ifconfig does that I need to do? Must I also send
a SOCADDRT command?

Thanks for any help,
Jon

I don’t think it is crashing – a pidin shows it still there with all its
threads. If
I do a manual ifconfig from a shell, the routes start working. Maybe
ifconfig
sends a SIGHUP signal to io-net to reawaken it?

“Sreekanth” <nospam@nospam.com> wrote in message
news:b76ukb$cbl$1@inn.qnx.com

“Writing to routing socket:No such process” Indicates that io-net is
crashing.Something that you are writing with SIOC* ioctls is causing
it.Examine the io-net core and see where it has crashed…

Sreekanth

“Jon Wyatt” <> jon.nospam.wyatt@removethis.ustraffic.net> > wrote in message
news:b75cr9$gjt$> 1@inn.qnx.com> …
I have an application (using RTP 6.1) that must set the IP address and
netmask based on an externally read address. I’m changing them using
ioctl() and SIOCSIFADDR, SIOCSIFNETMASK, and SIOCSIFBRDADDR.

After I do this I can’t access the network. A ping returns
“ping: sendto: No route to host”

and route returns
“writing to routing socket: No such process”.

However, if I manually set the same IP and netmask using ifconfig
in a shell, everything works fine. There’s no differences in the
processes
before and after that I can see.

What else is it that ifconfig does that I need to do? Must I also send
a SOCADDRT command?

Thanks for any help,
Jon
\

Look at ‘netstat -rn’, ‘netstat -in’, 'ifconfig ’ to see
what’s different from when you do it and ifconfig does.

-seanb

Jon Wyatt <jon.nospam.wyatt@removethis.ustraffic.net> wrote:

I don’t think it is crashing – a pidin shows it still there with all its
threads. If
I do a manual ifconfig from a shell, the routes start working. Maybe
ifconfig
sends a SIGHUP signal to io-net to reawaken it?

“Sreekanth” <> nospam@nospam.com> > wrote in message
news:b76ukb$cbl$> 1@inn.qnx.com> …
“Writing to routing socket:No such process” Indicates that io-net is
crashing.Something that you are writing with SIOC* ioctls is causing
it.Examine the io-net core and see where it has crashed…

Sreekanth

“Jon Wyatt” <> jon.nospam.wyatt@removethis.ustraffic.net> > wrote in message
news:b75cr9$gjt$> 1@inn.qnx.com> …
I have an application (using RTP 6.1) that must set the IP address and
netmask based on an externally read address. I’m changing them using
ioctl() and SIOCSIFADDR, SIOCSIFNETMASK, and SIOCSIFBRDADDR.

After I do this I can’t access the network. A ping returns
“ping: sendto: No route to host”

and route returns
“writing to routing socket: No such process”.

However, if I manually set the same IP and netmask using ifconfig
in a shell, everything works fine. There’s no differences in the
processes
before and after that I can see.

What else is it that ifconfig does that I need to do? Must I also send
a SOCADDRT command?

Thanks for any help,
Jon
\

There’s an additional entry in the routing table (see output below). I’ll
try using SIOCADDRT.

By the way – using: system( “ifconfig en0…”) worked, but I couldn’t
get any workable error conditions when there was a problem with
the Ethernet interface (like it wasn’t there).

ifconfig en0

en0: flags=843<UP,BROADCAST,RUNNING,SIMPLEX> mtu 1500
inet 128.2.0.90 netmask 0xfff00000 broadcast 128.15.255.255

ping 128.1.16.58

PING 128.1.16.58 (128.1.16.58): 56 data bytes
ping: sendto: No route to host
ping: wrote 128.1.16.58 64 chars, ret=-1
ping: sendto: No route to host
ping: wrote 128.1.16.58 64 chars, ret=-1

— 128.1.16.58 ping statistics —
2 packets transmitted, 0 packets received, 100% packet loss

netstat -rn

Routing tables

Internet:
Destination Gateway Flags Refs Use Mtu
Interface
127.0.0.1 127.0.0.1 UH 0 0 - lo0
128.2 128.2.0.90 U 0 0 - en0
128.2.0.90 128.2.0.90 UH 0 0 - lo0

netstat -in

Name Mtu Network Address Ipkts Ierrs Opkts Oerrs
Coll
lo0 32976 0 0 0 0
0
lo0 32976 127 127.0.0.1 0 0 0 0
0
en0 1500 00:50:c2:13:00:5a 3433 0 5 0
0
en0 1500 128.2/12 128.2.0.90 3433 0 5 0
0

route get 128.1.16.58

writing to routing socket: No such process

ifconfig en0 128.2.0.90 netmask 255.240.0.0

ifconfig en0

en0: flags=843<UP,BROADCAST,RUNNING,SIMPLEX> mtu 1500
inet 128.2.0.90 netmask 0xfff00000 broadcast 128.15.255.255

ping 128.1.16.58

PING 128.1.16.58 (128.1.16.58): 56 data bytes
64 bytes from 128.1.16.58: icmp_seq=0 ttl=255 time=6 ms
64 bytes from 128.1.16.58: icmp_seq=1 ttl=255 time=5 ms

— 128.1.16.58 ping statistics —
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 5/5/6 ms

netstat -rn

Routing tables

Internet:
Destination Gateway Flags Refs Use Mtu
Interface
127.0.0.1 127.0.0.1 UH 0 0 - lo0
128/12 128.2.0.90 U 0 2 - en0
128.2 128.2.0.90 U 0 0 - en0
128.2.0.90 128.2.0.90 UH 0 0 - lo0

netstat -in

Name Mtu Network Address Ipkts Ierrs Opkts Oerrs
Coll
lo0 32976 0 0 0 0
0
lo0 32976 127 127.0.0.1 0 0 0 0
0
en0 1500 00:50:c2:13:00:5a 3605 0 9 0
0
en0 1500 128/12 128.2.0.90 3605 0 9 0
0

route get 128.1.16.58

route to: dell2.astcqnx
destination: 128.0.0.0
mask: 255.240.0.0
interface: en0
flags: <UP,DONE>
recvpipe sendpipe ssthresh rtt,msec rttvar hopcount mtu
expire
0 0 0 0 0 0 0
0



“Sean Boudreau” <seanb@node25.ott.qnx.com> wrote in message
news:b77kv6$l52$1@nntp.qnx.com

Look at ‘netstat -rn’, ‘netstat -in’, 'ifconfig ’ to see
what’s different from when you do it and ifconfig does.

-seanb

Jon Wyatt <> jon.nospam.wyatt@removethis.ustraffic.net> > wrote:
I don’t think it is crashing – a pidin shows it still there with all
its
threads. If
I do a manual ifconfig from a shell, the routes start working. Maybe
ifconfig
sends a SIGHUP signal to io-net to reawaken it?

“Sreekanth” <> nospam@nospam.com> > wrote in message
news:b76ukb$cbl$> 1@inn.qnx.com> …
“Writing to routing socket:No such process” Indicates that io-net is
crashing.Something that you are writing with SIOC* ioctls is causing
it.Examine the io-net core and see where it has crashed…

Sreekanth

“Jon Wyatt” <> jon.nospam.wyatt@removethis.ustraffic.net> > wrote in
message
news:b75cr9$gjt$> 1@inn.qnx.com> …
I have an application (using RTP 6.1) that must set the IP address
and
netmask based on an externally read address. I’m changing them using
ioctl() and SIOCSIFADDR, SIOCSIFNETMASK, and SIOCSIFBRDADDR.

After I do this I can’t access the network. A ping returns
“ping: sendto: No route to host”

and route returns
“writing to routing socket: No such process”.

However, if I manually set the same IP and netmask using ifconfig
in a shell, everything works fine. There’s no differences in the
processes
before and after that I can see.

What else is it that ifconfig does that I need to do? Must I also
send
a SOCADDRT command?

Thanks for any help,
Jon


\