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