Deleted Added
full compact
if.c (128073) if.c (128186)
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD: head/sbin/routed/if.c 128073 2004-04-09 19:58:40Z markm $
29 * $FreeBSD: head/sbin/routed/if.c 128186 2004-04-13 11:24:43Z luigi $
30 */
31
32#include "defs.h"
33#include "pathnames.h"
34
35#ifdef __NetBSD__
36__RCSID("$NetBSD$");
37#elif defined(__FreeBSD__)
30 */
31
32#include "defs.h"
33#include "pathnames.h"
34
35#ifdef __NetBSD__
36__RCSID("$NetBSD$");
37#elif defined(__FreeBSD__)
38__RCSID("$FreeBSD: head/sbin/routed/if.c 128073 2004-04-09 19:58:40Z markm $");
38__RCSID("$FreeBSD: head/sbin/routed/if.c 128186 2004-04-13 11:24:43Z luigi $");
39#else
40__RCSID("$Revision: 2.27 $");
41#ident "$Revision: 2.27 $"
42#endif
39#else
40__RCSID("$Revision: 2.27 $");
41#ident "$Revision: 2.27 $"
42#endif
43#ident "$FreeBSD: head/sbin/routed/if.c 128073 2004-04-09 19:58:40Z markm $"
43#ident "$FreeBSD: head/sbin/routed/if.c 128186 2004-04-13 11:24:43Z luigi $"
44struct interface *ifnet; /* all interfaces */
45
46/* hash table for all interfaces, big enough to tolerate ridiculous
47 * numbers of IP aliases. Crazy numbers of aliases such as 7000
48 * still will not do well, but not just in looking up interfaces
49 * by name or address.
50 */
51#define AHASH_LEN 211 /* must be prime */

--- 580 unchanged lines hidden (view full) ---

632 struct sockaddr *sa,
633 struct sockaddr *lim,
634 int addrs)
635{
636 int i;
637#ifdef _HAVE_SA_LEN
638 static struct sockaddr sa_zero;
639#endif
44struct interface *ifnet; /* all interfaces */
45
46/* hash table for all interfaces, big enough to tolerate ridiculous
47 * numbers of IP aliases. Crazy numbers of aliases such as 7000
48 * still will not do well, but not just in looking up interfaces
49 * by name or address.
50 */
51#define AHASH_LEN 211 /* must be prime */

--- 580 unchanged lines hidden (view full) ---

632 struct sockaddr *sa,
633 struct sockaddr *lim,
634 int addrs)
635{
636 int i;
637#ifdef _HAVE_SA_LEN
638 static struct sockaddr sa_zero;
639#endif
640#ifdef sgi
641#define ROUNDUP(a) ((a) > 0 ? (1 + (((a) - 1) | (sizeof(__uint64_t) - 1))) \
642 : sizeof(__uint64_t))
643#else
644#define ROUNDUP(a) ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) \
645 : sizeof(long))
646#endif
647
640
648
649 memset(info, 0, sizeof(*info));
650 info->rti_addrs = addrs;
651 for (i = 0; i < RTAX_MAX && sa < lim; i++) {
652 if ((addrs & (1 << i)) == 0)
653 continue;
641 memset(info, 0, sizeof(*info));
642 info->rti_addrs = addrs;
643 for (i = 0; i < RTAX_MAX && sa < lim; i++) {
644 if ((addrs & (1 << i)) == 0)
645 continue;
654#ifdef _HAVE_SA_LEN
655 info->rti_info[i] = (sa->sa_len != 0) ? sa : &sa_zero;
646 info->rti_info[i] = (sa->sa_len != 0) ? sa : &sa_zero;
656 sa = (struct sockaddr *)((char*)(sa)
657 + ROUNDUP(sa->sa_len));
658#else
659 info->rti_info[i] = sa;
660 sa = (struct sockaddr *)((char*)(sa)
661 + ROUNDUP(_FAKE_SA_LEN_DST(sa)));
662#endif
647 sa = (struct sockaddr *)((char*)(sa) + SA_SIZE(sa));
663 }
664}
665
666
667/* Find the network interfaces which have configured themselves.
668 * This must be done regularly, if only for extra addresses
669 * that come and go on interfaces.
670 */

--- 742 unchanged lines hidden ---
648 }
649}
650
651
652/* Find the network interfaces which have configured themselves.
653 * This must be done regularly, if only for extra addresses
654 * that come and go on interfaces.
655 */

--- 742 unchanged lines hidden ---