]>
git.saurik.com Git - apple/network_cmds.git/blob - ifconfig.tproj/nexus.c
3df98428399a6d4a067c135bb394e215c9d4acb1
2 * Copyright (c) 2017 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
25 * - report information about attached nexus
29 * Modification History:
31 * April 10, 2017 Dieter Siegmund (dieter@apple.com)
35 #include <sys/param.h>
36 #include <sys/ioctl.h>
37 #include <sys/socket.h>
42 #include <net/ethernet.h>
44 #include <net/if_var.h>
45 #include <net/if_fake_var.h>
47 #include <net/route.h>
62 struct if_nexusreq ifnr
;
63 uuid_string_t flowswitch
;
69 bzero((char *)&ifnr
, sizeof(ifnr
));
70 strlcpy(ifnr
.ifnr_name
, ifr
.ifr_name
, sizeof(ifnr
.ifnr_name
));
71 if (ioctl(s
, SIOCGIFNEXUS
, &ifnr
) < 0) {
74 if (uuid_is_null(ifnr
.ifnr_netif
)) {
75 /* technically, this shouldn't happen */
78 uuid_unparse_upper(ifnr
.ifnr_netif
, netif
);
79 printf("\tnetif: %s\n", netif
);
80 if (uuid_is_null(ifnr
.ifnr_flowswitch
) == 0) {
81 uuid_unparse_upper(ifnr
.ifnr_flowswitch
, flowswitch
);
82 printf("\tflowswitch: %s\n", flowswitch
);
87 static struct afswtch af_fake
= {
90 .af_other_status
= nexus_status
,
93 static __constructor
void
96 af_register(&af_fake
);