- if (addresses[unit] != NULL)
- free_wordlist(addresses[unit]);
- addresses[unit] = addrs;
-
- /*
- * If there's only one authorized address we might as well
- * ask our peer for that one right away
- */
- if (addrs != NULL && addrs->next == NULL) {
- char *p = addrs->word;
- struct ipcp_options *wo = &ipcp_wantoptions[unit];
- u_int32_t a;
- struct hostent *hp;
-
- if (*p != '!' && *p != '-' && *p != '*' && strchr(p, '/') == NULL) {
- hp = gethostbyname(p);
- if (hp != NULL && hp->h_addrtype == AF_INET)
- a = *(u_int32_t *)hp->h_addr;
- else
- a = inet_addr(p);
- if (a != (u_int32_t) -1)
- wo->hisaddr = a;
- }
- }
-}
-
-/*
- * auth_ip_addr - check whether the peer is authorized to use
- * a given IP address. Returns 1 if authorized, 0 otherwise.
- */
-int
-auth_ip_addr(unit, addr)
- int unit;
- u_int32_t addr;
-{
-
- if (addresses[unit] == NULL) {
- if (auth_required)
- return 0; /* no addresses authorized */
- return allow_any_ip || !have_route_to(addr);
- }
- return ip_addr_check(addr, addresses[unit]);
-}
-
-static int
-ip_addr_check(addr, addrs)
- u_int32_t addr;
- struct wordlist *addrs;
-{
- u_int32_t a, mask, ah;
- int accept;