games/quiz: add another president answer section and update data
[dragonfly.git] / usr.sbin / atm / atmarpd / atmarp_config.c
blobd1e085f84dade4f7ff5039d25095410ab1b9b01a
1 /*
3 * ===================================
4 * HARP | Host ATM Research Platform
5 * ===================================
8 * This Host ATM Research Platform ("HARP") file (the "Software") is
9 * made available by Network Computing Services, Inc. ("NetworkCS")
10 * "AS IS". NetworkCS does not provide maintenance, improvements or
11 * support of any kind.
13 * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
14 * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
15 * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
16 * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
17 * In no event shall NetworkCS be responsible for any damages, including
18 * but not limited to consequential damages, arising from or relating to
19 * any use of the Software or related support.
21 * Copyright 1994-1998 Network Computing Services, Inc.
23 * Copies of this Software may be made, however, the above copyright
24 * notice must be reproduced on all copies.
26 * @(#) $FreeBSD: src/usr.sbin/atm/atmarpd/atmarp_config.c,v 1.3 1999/08/28 01:15:29 peter Exp $
27 * @(#) $DragonFly: src/usr.sbin/atm/atmarpd/atmarp_config.c,v 1.3 2003/11/15 20:33:42 eirikn Exp $
31 * Server Cache Synchronization Protocol (SCSP) Support
32 * ----------------------------------------------------
34 * SCSP-ATMARP server interface: configuration support
38 #include <sys/types.h>
39 #include <sys/param.h>
40 #include <sys/socket.h>
41 #include <net/if.h>
42 #include <netinet/in.h>
43 #include <netatm/port.h>
44 #include <netatm/queue.h>
45 #include <netatm/atm.h>
46 #include <netatm/atm_if.h>
47 #include <netatm/atm_sap.h>
48 #include <netatm/atm_sys.h>
49 #include <netatm/atm_ioctl.h>
51 #include <errno.h>
52 #include <libatm.h>
53 #include <stdio.h>
54 #include <stdlib.h>
55 #include <string.h>
56 #include <syslog.h>
58 #include "../scspd/scsp_msg.h"
59 #include "../scspd/scsp_if.h"
60 #include "../scspd/scsp_var.h"
61 #include "atmarp_var.h"
64 * Configure network interface for ATMARP cache synchronization
66 * Verify the network interface name and set the appropriate fields
67 * in the ATMARP interface entry.
69 * Arguments:
70 * netif pointer to network interface name
72 * Returns:
73 * 0 success
74 * errno reason for failure
77 int
78 atmarp_cfg_netif(char *netif)
80 int rc;
81 Atmarp_intf *aip = NULL;
84 * Get an ATMARP interface block
86 aip = (Atmarp_intf *)UM_ALLOC(sizeof(Atmarp_intf));
87 if (!aip)
88 atmarp_mem_err("atmarp_cfg_netif: sizeof(Atmarp_intf)");
89 UM_ZERO(aip, sizeof(Atmarp_intf));
92 * Make sure we're configuring a valid
93 * network interface
95 rc = verify_nif_name(netif);
96 if (rc == 0) {
97 fprintf(stderr, "%s: \"%s\" is not a valid network interface\n",
98 prog, netif);
99 rc = EINVAL;
100 goto cfg_fail;
101 } else if (rc < 0) {
102 rc = errno;
103 fprintf(stderr, "%s: can't verify network interface \"%s\"\n",
104 prog, netif);
105 goto cfg_fail;
109 * Update the interface entry
111 strcpy(aip->ai_intf, netif);
112 aip->ai_state = AI_STATE_NULL;
113 aip->ai_scsp_sock = -1;
114 LINK2TAIL(aip, Atmarp_intf, atmarp_intf_head, ai_next);
116 return(0);
118 cfg_fail:
119 if (aip)
120 UM_FREE(aip);
122 return(rc);