]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Handle an interface coming and going better with a tailq list.
authorRoy Marples <roy@marples.name>
Wed, 22 May 2013 22:55:36 +0000 (22:55 +0000)
committerRoy Marples <roy@marples.name>
Wed, 22 May 2013 22:55:36 +0000 (22:55 +0000)
Ensure we check correct options when building ipv6 routes.

ipv6.c
ipv6rs.c

diff --git a/ipv6.c b/ipv6.c
index bf1f33959ac5153fb98d86cb9ec25fb59950e5ec..4312d5a0bfdefbf00d1ea6428afd26dc1d8e3066 100644 (file)
--- a/ipv6.c
+++ b/ipv6.c
@@ -652,7 +652,7 @@ ipv6_buildroutes1(struct rt6head *dnr, int expired)
        TAILQ_FOREACH(rap, &ipv6_routers, next) {
                if (rap->expired != expired)
                        continue;
-               if (options & DHCPCD_IPV6RA_OWN) {
+               if (rap->iface->options->options & DHCPCD_IPV6RA_OWN) {
                        TAILQ_FOREACH(addr, &rap->addrs, next) {
                                if (!addr->onlink)
                                        continue;
@@ -661,9 +661,13 @@ ipv6_buildroutes1(struct rt6head *dnr, int expired)
                                        TAILQ_INSERT_TAIL(dnr, rt, next);
                        }
                }
-               rt = make_router(rap);
-               if (rt)
-                       TAILQ_INSERT_TAIL(dnr, rt, next);
+               if (rap->iface->options->options &
+                   (DHCPCD_IPV6RA_OWN | DHCPCD_IPV6RA_OWN_DEFAULT))
+               {
+                       rt = make_router(rap);
+                       if (rt)
+                               TAILQ_INSERT_TAIL(dnr, rt, next);
+               }
        }
 }
 
index 7d130009348c62277540431af9f06478aafbcd6d..61f8a7ecffe0b511fa69f0c866428f9490cde723 100644 (file)
--- a/ipv6rs.c
+++ b/ipv6rs.c
@@ -337,7 +337,8 @@ void ipv6rs_freedrop_ra(struct ra *rap, int drop)
 
        eloop_timeout_delete(NULL, rap->iface);
        eloop_timeout_delete(NULL, rap);
-       TAILQ_REMOVE(&ipv6_routers, rap, next);
+       if (!drop)
+               TAILQ_REMOVE(&ipv6_routers, rap, next);
        ipv6rs_freedrop_addrs(rap, drop);
        ipv6rs_free_opts(rap);
        free(rap->data);