~ubuntu-branches/ubuntu/trusty/keepalived/trusty

« back to all changes in this revision

Viewing changes to keepalived/vrrp/vrrp_ipaddress.c

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Wirt
  • Date: 2005-04-29 23:22:40 UTC
  • mfrom: (1.1.1 upstream) (2.1.1 hoary)
  • Revision ID: james.westby@ubuntu.com-20050429232240-a8m3jtpi3cvuyyy2
Tags: 1.1.11-3
Added a warning about sarge kernels to README.Debian and 
the package description 

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 *
6
6
 * Part:        NETLINK IPv4 address manipulation.
7
7
 *
8
 
 * Version:     $Id: vrrp_ipaddress.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
 
8
 * Version:     $Id: vrrp_ipaddress.c,v 1.1.11 2005/03/01 01:22:13 acassen Exp $
9
9
 *
10
10
 * Author:      Alexandre Cassen, <acassen@linux-vs.org>
11
11
 *
19
19
 *              as published by the Free Software Foundation; either version
20
20
 *              2 of the License, or (at your option) any later version.
21
21
 *
22
 
 * Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
 
22
 * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
23
23
 */
24
24
 
25
25
/* local include */
29
29
#include "memory.h"
30
30
#include "utils.h"
31
31
 
32
 
/* extern global vars */
33
 
extern vrrp_conf_data *vrrp_data;
34
 
extern vrrp_conf_data *old_vrrp_data;
35
 
 
36
32
/* Add/Delete IP address to a specific interface */
37
33
int
38
34
netlink_address_ipv4(ip_address *ipaddr, int cmd)
74
70
        if (LIST_ISEMPTY(ip_list))
75
71
                return;
76
72
 
 
73
        /*
 
74
         * If "--dont-release-vrrp" (debug & 8) is set then try to release
 
75
         * addresses that may be there, even if we didn't set them.
 
76
         */
77
77
        for (e = LIST_HEAD(ip_list); e; ELEMENT_NEXT(e)) {
78
78
                ipaddress = ELEMENT_DATA(e);
79
79
                if ((cmd && !ipaddress->set) ||
80
 
                    (!cmd && ipaddress->set)) {
 
80
                    (!cmd && (ipaddress->set || debug & 8))) {
81
81
                        if (netlink_address_ipv4(ipaddress, cmd) > 0)
82
82
                                ipaddress->set = (cmd) ? 1 : 0;
83
83
                        else
88
88
 
89
89
/* IP address dump/allocation */
90
90
void
91
 
free_ipaddress(void *data)
 
91
free_ipaddress(void *if_data_obj)
92
92
{
93
 
        FREE(data);
 
93
        FREE(if_data_obj);
94
94
}
95
95
void
96
 
dump_ipaddress(void *data)
 
96
dump_ipaddress(void *if_data_obj)
97
97
{
98
 
        ip_address *ip_addr = data;
 
98
        ip_address *ip_addr = if_data_obj;
99
99
        syslog(LOG_INFO, "     %s/%d brd %s dev %s scope %s"
100
100
               , inet_ntop2(ip_addr->addr)
101
101
               , ip_addr->mask
127
127
                /* cmd parsing */
128
128
                if (!strcmp(str, "dev")) {
129
129
                        new->ifp = if_get_by_ifname(VECTOR_SLOT(strvec, ++i));
 
130
                        if (!new->ifp) {
 
131
                                syslog(LOG_INFO, "VRRP is trying to assign VIP to unknown %s"
 
132
                                       " interface !!! go out and fixe your conf !!!",
 
133
                                       (char *)VECTOR_SLOT(strvec, i));
 
134
                                FREE(new);
 
135
                                return;
 
136
                        }
130
137
                        new->ifindex = IF_INDEX(new->ifp);
131
138
                } else if (!strcmp(str, "scope")) {
132
139
                        new->scope = netlink_scope_a2n(VECTOR_SLOT(strvec, ++i));