summaryrefslogtreecommitdiff
path: root/net/openbgpd/files/patch-bgpd_carp.c
blob: fee9e485761e28db928be0be02362f2ace33a0f7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
--- bgpd/carp.c	2007-04-23 16:52:28.000000000 +0200
+++ bgpd/carp.c	2008-03-18 13:27:29.000000000 +0100
@@ -102,28 +102,7 @@
 int
 carp_demote_get(char *group)
 {
-	int			s;
-	struct ifgroupreq	ifgr;
-
-	if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
-		log_warn("carp_demote_get: socket");
-		return (-1);
-	}
-
-	bzero(&ifgr, sizeof(ifgr));
-	strlcpy(ifgr.ifgr_name, group, sizeof(ifgr.ifgr_name));
-
-	if (ioctl(s, SIOCGIFGATTR, (caddr_t)&ifgr) == -1) {
-		if (errno == ENOENT)
-			log_warnx("group \"%s\" does not exist", group);
-		else
-			log_warn("carp_demote_get: ioctl");
-		close(s);
 		return (-1);
-	}
-
-	close(s);
-	return ((int)ifgr.ifgr_attrib.ifg_carp_demoted);
 }
 
 int
@@ -156,26 +135,5 @@
 int
 carp_demote_ioctl(char *group, int demote)
 {
-	int			s, res;
-	struct ifgroupreq	ifgr;
-
-	if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
-		log_warn("carp_demote_get: socket");
 		return (-1);
-	}
-
-	bzero(&ifgr, sizeof(ifgr));
-	strlcpy(ifgr.ifgr_name, group, sizeof(ifgr.ifgr_name));
-	ifgr.ifgr_attrib.ifg_carp_demoted = demote;
-
-	if ((res = ioctl(s, SIOCSIFGATTR, (caddr_t)&ifgr)) == -1)
-		log_warn("unable to %s the demote state "
-		    "of group '%s'", (demote > 0) ? "increment" : "decrement",
-		    group);
-	else
-		log_info("%s the demote state of group '%s'",
-		    (demote > 0) ? "incremented" : "decremented", group);
-
-	close(s);
-	return (res);
 }