~ubuntu-branches/ubuntu/jaunty/xorp/jaunty

« back to all changes in this revision

Viewing changes to rib/vifmanager.cc

  • Committer: Bazaar Package Importer
  • Author(s): Jose Calhariz, Javier Fernandez-Sanguino, Jose Calhariz
  • Date: 2008-01-23 01:24:37 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080123012437-7l2u9r0k8e7op8st
Tags: 1.5~cvs.20080128-1
[ Javier Fernandez-Sanguino ]
* Update to latest CVS contents
* Modify debian/rules to prevent autobuilders from building 
  the binary-independent components: (Closes: #441121)
  - Create a new Build-Depends-Indep with all the TeX
  components used to build documentation
  - Since autobuilders call build, which in turns calls build-indep, hack
    the debian rules file so that the documentation is only built if ps2pdf,
    dvips and pslatex are available. 
* Modify the init.d script:
  - restart action: Do not attempt to stop xorp if not running
  - stop function: fix errors in the script
  - add a try-restart action
  - restructure the init.d script, move the restart code to a function
  - review the use of echo calls and exit values
* Use, as examples, the new boot files at rtrmgr/config/

[ Jose Calhariz ]
* Add depends on ncurses-dev, I don't know why xorp use tigetstr
  function from curses.  This way the depends field change less between
  build environments.
* Removed pushd and popd commands from Makefile and replaced with cd
  commands, was a bashism and FTBFS (closes: #453637)
* debian/control converted to utf-8 (closes: #454026) (closes: #453485)
* init.d/xorp now returns 0 if disabled.
* Added Vcs-Browser and Vcs-Svn fields pointing to the repository of the
  package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
2
2
 
3
 
// Copyright (c) 2001-2007 International Computer Science Institute
 
3
// Copyright (c) 2001-2008 International Computer Science Institute
4
4
//
5
5
// Permission is hereby granted, free of charge, to any person obtaining a
6
6
// copy of this software and associated documentation files (the "Software")
12
12
// notice is a summary of the XORP LICENSE file; the license in that file is
13
13
// legally binding.
14
14
 
15
 
#ident "$XORP: xorp/rib/vifmanager.cc,v 1.46 2007/05/08 01:15:51 pavlin Exp $"
 
15
#ident "$XORP: xorp/rib/vifmanager.cc,v 1.51 2008/01/04 03:17:28 pavlin Exp $"
16
16
 
17
17
#include "rib_module.h"
18
18
 
82
82
 
83
83
    enable();   // XXX: by default the VifManager is always enabled
84
84
 
85
 
    if (ProtoState::pending_start() < 0)
 
85
    if (ProtoState::pending_start() != XORP_OK)
86
86
        return (XORP_ERROR);
87
87
 
88
88
    //
89
89
    // Startup the interface manager
90
90
    //
91
 
    if (ifmgr_startup() != true) {
 
91
    if (ifmgr_startup() != XORP_OK) {
92
92
        ServiceBase::set_status(SERVICE_FAILED);
93
93
        return (XORP_ERROR);
94
94
    }
112
112
        return (XORP_ERROR);
113
113
#endif
114
114
 
115
 
    if (ProtoState::start() < 0) {
 
115
    if (ProtoState::start() != XORP_OK) {
116
116
        ProtoState::stop();
117
117
        return (XORP_ERROR);
118
118
    }
139
139
    if (! (is_up() || is_pending_up() || is_pending_down()))
140
140
        return (XORP_ERROR);
141
141
 
142
 
    if (ProtoState::pending_stop() < 0)
 
142
    if (ProtoState::pending_stop() != XORP_OK)
143
143
        return (XORP_ERROR);
144
144
 
145
145
    //
146
146
    // Shutdown the interface manager
147
147
    //
148
 
    if (ifmgr_shutdown() != true) {
 
148
    if (ifmgr_shutdown() != XORP_OK) {
149
149
        ServiceBase::set_status(SERVICE_FAILED);
150
150
        return (XORP_ERROR);
151
151
    }
168
168
    if (! (is_up() || is_pending_up() || is_pending_down()))
169
169
        return (XORP_ERROR);
170
170
#endif
171
 
    if (ProtoState::stop() < 0)
 
171
    if (ProtoState::stop() != XORP_OK)
172
172
        return (XORP_ERROR);
173
173
 
174
174
    // Clear the old state
188
188
        if ((old_status == SERVICE_STARTING)
189
189
            && (new_status == SERVICE_RUNNING)) {
190
190
            // The startup process has completed
191
 
            if (final_start() < 0) {
 
191
            if (final_start() != XORP_OK) {
192
192
                XLOG_ERROR("Cannot complete the startup process; "
193
193
                           "current state is %s",
194
194
                           ProtoState::state_str().c_str());
253
253
    }
254
254
}
255
255
 
256
 
bool
 
256
int
257
257
VifManager::ifmgr_startup()
258
258
{
259
 
    bool ret_value;
 
259
    int ret_value;
260
260
 
261
261
    // TODO: XXX: we should startup the ifmgr only if it hasn't started yet
262
262
    incr_startup_requests_n();
268
268
    // will be called.
269
269
    //
270
270
 
271
 
    return ret_value;
 
271
    return (ret_value);
272
272
}
273
273
 
274
 
bool
 
274
int
275
275
VifManager::ifmgr_shutdown()
276
276
{
277
 
    bool ret_value;
 
277
    int ret_value;
278
278
 
279
279
    incr_shutdown_requests_n();
280
280
 
285
285
    // will be called.
286
286
    //
287
287
 
288
 
    return ret_value;
 
288
    return (ret_value);
289
289
}
290
290
 
291
291
void
362
362
 
363
363
            //
364
364
            // Update or set the vif flags
365
 
            // XXX: discard property needs to be inherited from
366
 
            // the parent interface, once it has been marshaled.
 
365
            // XXX: Other properties (discard, unreachable, management)
 
366
            // need to be inherited from the parent interface, once it has
 
367
            // been marshaled.
367
368
            //
368
369
            bool is_up = ifmgr_iface.enabled() && ifmgr_vif.enabled();
369
370
            is_up &= (! ifmgr_iface.no_carrier());      // XXX: the link state