From 869c695998f0bc3b80d8500d88a53fb169c21bc1 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Mon, 1 Jun 1998 21:41:32 +0000 Subject: [PATCH] Synced to new interface code. --- sysdep/unix/io.c | 2 +- sysdep/unix/main.c | 1 + sysdep/unix/sync-if.c | 28 +++++++++++++--------------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c index 45ba0f82..a94b8ea4 100644 --- a/sysdep/unix/io.c +++ b/sysdep/unix/io.c @@ -412,7 +412,7 @@ sk_open(sock *s) if (has_src) set_inaddr(&mreq, s->saddr); else - set_inaddr(&mreq, s->iface->ifa->ip); + set_inaddr(&mreq, s->iface->ip); memcpy(&mreq_add.imr_interface, &mreq, sizeof(struct in_addr)); #endif set_inaddr(&mreq_add.imr_multiaddr, s->daddr); diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c index 293ee63f..5efd0506 100644 --- a/sysdep/unix/main.c +++ b/sysdep/unix/main.c @@ -31,6 +31,7 @@ handle_sigusr(int sig) sk_dump_all(); tm_dump_all(); if_dump_all(); + neigh_dump_all(); rta_dump_all(); rt_dump_all(); diff --git a/sysdep/unix/sync-if.c b/sysdep/unix/sync-if.c index 742421f1..641565fd 100644 --- a/sysdep/unix/sync-if.c +++ b/sysdep/unix/sync-if.c @@ -30,7 +30,6 @@ static void scan_ifs(struct ifreq *r, int cnt) { struct iface i; - struct ifa a; char *err; unsigned fl; ip_addr netmask; @@ -39,13 +38,11 @@ scan_ifs(struct ifreq *r, int cnt) for (cnt /= sizeof(struct ifreq); cnt; cnt--, r++) { bzero(&i, sizeof(i)); - bzero(&a, sizeof(a)); debug("%s\n", r->ifr_ifrn.ifrn_name); strncpy(i.name, r->ifr_ifrn.ifrn_name, sizeof(i.name) - 1); i.name[sizeof(i.name) - 1] = 0; - i.ifa = &a; - get_sockaddr((struct sockaddr_in *) &r->ifr_addr, &a.ip, NULL); - l = ipa_classify(a.ip); + get_sockaddr((struct sockaddr_in *) &r->ifr_addr, &i.ip, NULL); + l = ipa_classify(i.ip); if (l < 0 || !(l & IADDR_HOST)) { log(L_ERR "%s: Invalid interface address", i.name); @@ -76,15 +73,15 @@ scan_ifs(struct ifreq *r, int cnt) log(L_ERR "%s: Invalid netmask", i.name); goto bad; } - a.pxlen = l; + i.pxlen = l; if (fl & IFF_POINTOPOINT) { i.flags |= IF_UNNUMBERED; - a.pxlen = BITS_PER_IP_ADDRESS; + i.pxlen = BITS_PER_IP_ADDRESS; if (ioctl(if_scan_sock, SIOCGIFDSTADDR, r) < 0) { err = "SIOCGIFDSTADDR"; goto faulty; } - get_sockaddr((struct sockaddr_in *) &r->ifr_addr, &a.opposite, NULL); + get_sockaddr((struct sockaddr_in *) &r->ifr_addr, &i.opposite, NULL); } if (fl & IFF_LOOPBACK) i.flags |= IF_LOOPBACK | IF_IGNORE; @@ -93,24 +90,24 @@ scan_ifs(struct ifreq *r, int cnt) #endif i.flags |= IF_MULTICAST; - a.prefix = ipa_and(a.ip, ipa_mkmask(a.pxlen)); - if (a.pxlen < 32) + i.prefix = ipa_and(i.ip, ipa_mkmask(i.pxlen)); + if (i.pxlen < 32) { - a.brd = ipa_or(a.prefix, ipa_not(ipa_mkmask(a.pxlen))); - if (ipa_equal(a.ip, a.prefix) || ipa_equal(a.ip, a.brd)) + i.brd = ipa_or(i.prefix, ipa_not(ipa_mkmask(i.pxlen))); + if (ipa_equal(i.ip, i.prefix) || ipa_equal(i.ip, i.brd)) { log(L_ERR "%s: Using network or broadcast address for interface", i.name); goto bad; } if (fl & IFF_BROADCAST) i.flags |= IF_BROADCAST; - if (a.pxlen < 30) + if (i.pxlen < 30) i.flags |= IF_MULTIACCESS; else - a.opposite = ipa_opposite(a.ip); + i.opposite = ipa_opposite(i.ip); } else - a.brd = a.opposite; + i.brd = i.opposite; if (ioctl(if_scan_sock, SIOCGIFMTU, r) < 0) { err = "SIOCGIFMTU"; goto faulty; } @@ -124,6 +121,7 @@ scan_ifs(struct ifreq *r, int cnt) if_update(&i); } + if_end_update(); } static void