ng_atm.c (118175) | ng_atm.c (121816) |
---|---|
1/* 2 * Copyright (c) 2001-2003 3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 16 unchanged lines hidden (view full) --- 25 * SUCH DAMAGE. 26 * 27 * Author: Hartmut Brandt <harti@freebsd.org> 28 * 29 * Netgraph module to connect NATM interfaces to netgraph. 30 */ 31 32#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 2001-2003 3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 16 unchanged lines hidden (view full) --- 25 * SUCH DAMAGE. 26 * 27 * Author: Hartmut Brandt <harti@freebsd.org> 28 * 29 * Netgraph module to connect NATM interfaces to netgraph. 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/netgraph/atm/ng_atm.c 118175 2003-07-29 16:27:23Z harti $"); | 33__FBSDID("$FreeBSD: head/sys/netgraph/atm/ng_atm.c 121816 2003-10-31 18:32:15Z brooks $"); |
34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/kernel.h> 38#include <sys/malloc.h> 39#include <sys/mbuf.h> 40#include <sys/errno.h> 41#include <sys/syslog.h> --- 819 unchanged lines hidden (view full) --- 861 const char *vendor; 862 } devices[] = { 863 ATM_DEVICE_NAMES 864 }; 865 866 mib = (const struct ifatm_mib *)(priv->ifp->if_linkmib); 867 868 sbuf_new(&sbuf, arg, len, SBUF_FIXEDLEN); | 34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/kernel.h> 38#include <sys/malloc.h> 39#include <sys/mbuf.h> 40#include <sys/errno.h> 41#include <sys/syslog.h> --- 819 unchanged lines hidden (view full) --- 861 const char *vendor; 862 } devices[] = { 863 ATM_DEVICE_NAMES 864 }; 865 866 mib = (const struct ifatm_mib *)(priv->ifp->if_linkmib); 867 868 sbuf_new(&sbuf, arg, len, SBUF_FIXEDLEN); |
869 sbuf_printf(&sbuf, "interface: %s%d\n", priv->ifp->if_name, 870 priv->ifp->if_unit); | 869 sbuf_printf(&sbuf, "interface: %s\n", priv->ifp->if_xname); |
871 872 if (mib->device >= sizeof(devices) / sizeof(devices[0])) 873 sbuf_printf(&sbuf, "device=unknown\nvendor=unknown\n"); 874 else 875 sbuf_printf(&sbuf, "device=%s\nvendor=%s\n", 876 devices[mib->device].name, devices[mib->device].vendor); 877 878 for (i = 0; atmmedia[i].name; i++) --- 56 unchanged lines hidden (view full) --- 935 switch (msg->header.cmd) { 936 937 case NGM_ATM_GET_IFNAME: 938 NG_MKRESPONSE(resp, msg, IFNAMSIZ + 1, M_NOWAIT); 939 if (resp == NULL) { 940 error = ENOMEM; 941 break; 942 } | 870 871 if (mib->device >= sizeof(devices) / sizeof(devices[0])) 872 sbuf_printf(&sbuf, "device=unknown\nvendor=unknown\n"); 873 else 874 sbuf_printf(&sbuf, "device=%s\nvendor=%s\n", 875 devices[mib->device].name, devices[mib->device].vendor); 876 877 for (i = 0; atmmedia[i].name; i++) --- 56 unchanged lines hidden (view full) --- 934 switch (msg->header.cmd) { 935 936 case NGM_ATM_GET_IFNAME: 937 NG_MKRESPONSE(resp, msg, IFNAMSIZ + 1, M_NOWAIT); 938 if (resp == NULL) { 939 error = ENOMEM; 940 break; 941 } |
943 snprintf(resp->data, IFNAMSIZ + 1, "%s%d", 944 priv->ifp->if_name, priv->ifp->if_unit); | 942 strlcpy(resp->data, priv->ifp->if_xname, IFNAMSIZ + 1); |
945 break; 946 947 case NGM_ATM_GET_CONFIG: 948 { 949 struct ngm_atm_config *config; 950 951 NG_MKRESPONSE(resp, msg, sizeof(*config), M_NOWAIT); 952 if (resp == NULL) { --- 307 unchanged lines hidden (view full) --- 1260ng_atm_attach(struct ifnet *ifp) 1261{ 1262 char name[IFNAMSIZ+1]; 1263 node_p node; 1264 struct priv *priv; 1265 1266 KASSERT(IFP2NG(ifp) == 0, ("%s: node alreay exists?", __FUNCTION__)); 1267 | 943 break; 944 945 case NGM_ATM_GET_CONFIG: 946 { 947 struct ngm_atm_config *config; 948 949 NG_MKRESPONSE(resp, msg, sizeof(*config), M_NOWAIT); 950 if (resp == NULL) { --- 307 unchanged lines hidden (view full) --- 1258ng_atm_attach(struct ifnet *ifp) 1259{ 1260 char name[IFNAMSIZ+1]; 1261 node_p node; 1262 struct priv *priv; 1263 1264 KASSERT(IFP2NG(ifp) == 0, ("%s: node alreay exists?", __FUNCTION__)); 1265 |
1268 snprintf(name, sizeof(name), "%s%d", ifp->if_name, ifp->if_unit); | 1266 strlcpy(name, ifp->if_xname, sizeof(name)); |
1269 1270 if (ng_make_node_common(&ng_atm_typestruct, &node) != 0) { 1271 log(LOG_ERR, "%s: can't create node for %s\n", 1272 __FUNCTION__, name); 1273 return; 1274 } 1275 1276 priv = malloc(sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); --- 160 unchanged lines hidden --- | 1267 1268 if (ng_make_node_common(&ng_atm_typestruct, &node) != 0) { 1269 log(LOG_ERR, "%s: can't create node for %s\n", 1270 __FUNCTION__, name); 1271 return; 1272 } 1273 1274 priv = malloc(sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); --- 160 unchanged lines hidden --- |