Index: ng_device.c =================================================================== RCS file: /home/ncvs/src/sys/netgraph/ng_device.c,v retrieving revision 1.3 diff -u -u -r1.3 ng_device.c --- ng_device.c 3 Mar 2003 12:15:52 -0000 1.3 +++ ng_device.c 28 Jul 2003 01:04:31 -0000 @@ -354,27 +354,13 @@ NGI_GET_M(item, m); NG_FREE_ITEM(item); - m = m_pullup(m,m->m_len); - if(m == NULL) { - printf("%s(): ERROR: m_pullup failed\n",__func__); - return(-1); - } - - buffer = malloc(sizeof(char)*m->m_len, M_DEVBUF, M_NOWAIT | M_ZERO); - if(buffer == NULL) { - printf("%s(): ERROR: buffer malloc failed\n",__func__); - return(-1); - } - - buffer = mtod(m,char *); - - if( (connection->loc+m->m_len) < NGD_QUEUE_SIZE) { - memcpy(connection->readq+connection->loc, buffer, m->m_len); - connection->loc += m->m_len; - } else + if( (connection->loc+m->m_len) < NGD_QUEUE_SIZE) + m_copydata(m, 0, m->m_len, connection->readq+connection->loc); + else + /* XXX - we really should handle this failure case better */ printf("%s(): queue full, first read out a bit\n",__func__); - free(buffer,M_DEVBUF); + m_freem(m); return(0); }