From 51b6226c253d2608fa3982a42dbffe2535480cfd Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 1 Aug 2007 00:44:05 +0000 Subject: 2007-07-31 Joel Sherrill PR 1248/networking * libnetworking/rtems/rtems_glue.c: Luke Stras reported that when no interfaces are successfully attached, the default route is broken and may result in a jump to an illegal address. --- cpukit/ChangeLog | 8 ++++++++ cpukit/libnetworking/rtems/rtems_glue.c | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'cpukit') diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 640c3759ea..4ff0bcc2ae 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,11 @@ +2007-07-31 Joel Sherrill + + PR 1248/networking + * libnetworking/rtems/rtems_glue.c: Luke Stras + reported that when no interfaces are successfully attached, the + default route is broken and may result in a jump to an illegal + address. + 2007-07-31 Ralf Corsépius * score/inline/rtems/score/priority.inl: Use size_t instead of diff --git a/cpukit/libnetworking/rtems/rtems_glue.c b/cpukit/libnetworking/rtems/rtems_glue.c index 1ac5c1cf40..892e3eabe8 100644 --- a/cpukit/libnetworking/rtems/rtems_glue.c +++ b/cpukit/libnetworking/rtems/rtems_glue.c @@ -807,6 +807,7 @@ rtems_bsdnet_setup (void) struct sockaddr_in broadcast; struct sockaddr_in gateway; int i; + int any_if_configured = 0; /* * Set local parameters @@ -883,6 +884,9 @@ rtems_bsdnet_setup (void) printf ("Can't read %s flags: %s\n", ifp->name, strerror (errno)); continue; } + + any_if_configured = 1; + if (flags & IFF_BROADCAST) { memset (&broadcast, '\0', sizeof broadcast); broadcast.sin_len = sizeof broadcast; @@ -904,7 +908,7 @@ rtems_bsdnet_setup (void) /* * Set default route */ - if (rtems_bsdnet_config.gateway) { + if (rtems_bsdnet_config.gateway && any_if_configured) { address.sin_addr.s_addr = INADDR_ANY; netmask.sin_addr.s_addr = INADDR_ANY; memset (&gateway, '\0', sizeof gateway); -- cgit v1.2.3