]> git.saurik.com Git - apple/xnu.git/blob - bsd/net/rtsock_mip.c
xnu-792.24.17.tar.gz
[apple/xnu.git] / bsd / net / rtsock_mip.c
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /* $KAME$ */
23
24 /* to be included from net/rtsock.c - ugly but necessary for portability */
25 /*
26 * Mobile IPv6 addition.
27 * Send a routing message to all routing socket listeners.
28 */
29 void
30 rt_mip6msg(cmd, ifp, rt)
31 int cmd;
32 struct ifnet *ifp;
33 register struct rtentry *rt;
34 {
35 struct rt_addrinfo info;
36 struct sockaddr *sa = 0;
37 struct mbuf *m = 0;
38 register struct rt_msghdr *rtm;
39
40 #ifdef MIP6_DEBUG
41 printf("route_cb.any_count = %d\n", route_cb.any_count);
42 #endif
43 bzero((caddr_t)&info, sizeof(info));
44
45 if (rt == 0 || ifp == 0)
46 return;
47 netmask = rt_mask(rt);
48 dst = sa = rt_key(rt);
49 gate = rt->rt_gateway;
50 genmask = rt->rt_genmask;
51 if ((m = rt_msg1(cmd, &info)) == NULL) {
52 #ifdef MIP6_DEBUG
53 printf("failure... \n");
54 #endif
55 return;
56 }
57 rtm = mtod(m, struct rt_msghdr *);
58 rtm->rtm_index = ifp->if_index;
59 rtm->rtm_flags |= rt->rt_flags;
60 rtm->rtm_rmx = rt->rt_rmx;
61 rtm->rtm_addrs = info.rti_addrs;
62 rtm->rtm_flags |= RTF_DONE;
63
64 route_proto.sp_protocol = sa ? sa->sa_family : 0;
65 #ifdef __bsdi__
66 raw_input(m, NULL, &route_proto, &route_src, &route_dst);
67 #else
68 raw_input(m, &route_proto, &route_src, &route_dst);
69 #endif
70 }