1/* 2 * Copyright (c) 2001-2003 3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). 4 * All rights reserved. 5 * 6 * Author: Harti Brandt <harti@freebsd.org> 7 * 8 * Redistribution and use in source and binary forms, with or without --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * |
29 * $Begemot: bsnmp/snmp_mibII/mibII_interfaces.c,v 1.16 2005/11/02 12:07:40 brandt_h Exp $ |
30 * 31 * Interfaces group. 32 */ 33#include "mibII.h" 34#include "mibII_oid.h" 35 36/* 37 * This structure catches all changes to a interface entry --- 237 unchanged lines hidden (view full) --- 275 break; 276 277 case LEAF_ifAdminStatus: 278 value->v.integer = 279 (ifp->mib.ifmd_flags & IFF_UP) ? 1 : 2; 280 break; 281 282 case LEAF_ifOperStatus: |
283 /* 284 * According to RFC 2863 the state should be Up if the 285 * interface is ready to transmit packets. We takes this to 286 * mean that the interface should be running and should have 287 * a carrier. If it is running and has no carrier we interpret 288 * this as 'waiting for an external event' (plugging in the 289 * cable) and hence return 'dormant'. 290 */ 291 if (ifp->mib.ifmd_flags & IFF_RUNNING) { 292 if (ifp->mib.ifmd_data.ifi_link_state == 293 LINK_STATE_DOWN) 294 value->v.integer = 5; /* state dormant */ 295 else 296 value->v.integer = 1; /* state up */ 297 } else 298 value->v.integer = 2; /* state down */ |
299 break; 300 301 case LEAF_ifLastChange: 302 value->v.uint32 = 303 ticks_get_timeval(&ifp->mib.ifmd_data.ifi_lastchange); 304 break; 305 306 case LEAF_ifInOctets: --- 235 unchanged lines hidden --- |