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

« back to all changes in this revision

Viewing changes to keepalived/vrrp/vrrp_if.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:        Interfaces manipulation.
7
7
 *
8
 
 * Version:     $Id: vrrp_if.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
 
8
 * Version:     $Id: vrrp_if.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
/* global include */
57
57
#include "utils.h"
58
58
 
59
59
/* Global vars */
60
 
extern thread_master *master;
61
 
extern vrrp_conf_data *vrrp_data;
 
60
static list if_queue;
62
61
static struct ifreq ifr;
63
62
 
64
63
/* Helper functions */
69
68
        interface *ifp;
70
69
        element e;
71
70
 
 
71
        if (LIST_ISEMPTY(if_queue))
 
72
                return NULL;
 
73
 
72
74
        for (e = LIST_HEAD(if_queue); e; ELEMENT_NEXT(e)) {
73
75
                ifp = ELEMENT_DATA(e);
74
76
                if (ifp->ifindex == ifindex)
83
85
        interface *ifp;
84
86
        element e;
85
87
 
 
88
        if (LIST_ISEMPTY(if_queue))
 
89
                return NULL;
 
90
 
86
91
        for (e = LIST_HEAD(if_queue); e; ELEMENT_NEXT(e)) {
87
92
                ifp = ELEMENT_DATA(e);
88
93
                if (!strcmp(ifp->ifname, ifname))
240
245
}
241
246
 
242
247
void
243
 
dump_if(void *data)
 
248
dump_if(void *if_data_obj)
244
249
{
245
 
        interface *ifp = data;
 
250
        interface *ifp = if_data_obj;
246
251
 
247
252
        syslog(LOG_INFO, "------< NIC >------");
248
253
        syslog(LOG_INFO, " Name = %s", ifp->ifname);
301
306
 
302
307
#ifndef _WITH_LINKWATCH_
303
308
static int
304
 
if_linkbeat_refresh_thread(thread * thread)
 
309
if_linkbeat_refresh_thread(thread * thread_obj)
305
310
{
306
 
        interface *ifp = THREAD_ARG(thread);
 
311
        interface *ifp = THREAD_ARG(thread_obj);
307
312
 
308
313
        if (IF_MII_SUPPORTED(ifp))
309
314
                ifp->linkbeat = (if_mii_probe(ifp->ifname)) ? 1 : 0;
366
371
{
367
372
        if (!LIST_ISEMPTY(if_queue))
368
373
                free_list(if_queue);
369
 
        netlink_close(&nl_kernel);
370
 
        netlink_close(&nl_cmd);
 
374
        if_queue = NULL;
 
375
        kernel_netlink_close();
371
376
}
372
377
 
373
378
void
422
427
        int ret = 0;
423
428
 
424
429
        /* If fd is -1 then we add a membership trouble */
425
 
        if (sd < 0)
 
430
        if (sd < 0 || !ifp)
426
431
                return;
427
432
 
428
433
        /* Leaving the VRRP multicast group */