Merge branch 'master' into ppp-new

This commit is contained in:
Sylvain Rochet
2014-01-17 00:48:55 +01:00
8 changed files with 58 additions and 13 deletions

View File

@@ -769,16 +769,22 @@ netif_poll(struct netif *netif)
if (in != NULL) {
struct pbuf *in_end = in;
#if LWIP_LOOPBACK_MAX_PBUFS
u8_t clen = pbuf_clen(in);
u8_t clen = 1;
#endif /* LWIP_LOOPBACK_MAX_PBUFS */
while (in_end->len != in_end->tot_len) {
LWIP_ASSERT("bogus pbuf: len != tot_len but next == NULL!", in_end->next != NULL);
in_end = in_end->next;
#if LWIP_LOOPBACK_MAX_PBUFS
clen++;
#endif /* LWIP_LOOPBACK_MAX_PBUFS */
}
#if LWIP_LOOPBACK_MAX_PBUFS
/* adjust the number of pbufs on queue */
LWIP_ASSERT("netif->loop_cnt_current underflow",
((netif->loop_cnt_current - clen) < netif->loop_cnt_current));
netif->loop_cnt_current -= clen;
#endif /* LWIP_LOOPBACK_MAX_PBUFS */
while (in_end->len != in_end->tot_len) {
LWIP_ASSERT("bogus pbuf: len != tot_len but next == NULL!", in_end->next != NULL);
in_end = in_end->next;
}
/* 'in_end' now points to the last pbuf from 'in' */
if (in_end == netif->loop_last) {
/* this was the last pbuf in the list */

View File

@@ -772,8 +772,8 @@ static const s32_t sysservices = SNMP_SYSSERVICES;
/** mib-2.system.sysDescr */
static const u8_t sysdescr_len_default = 4;
static const u8_t sysdescr_default[] = "lwIP";
static u8_t* sysdescr_len_ptr = (u8_t*)&sysdescr_len_default;
static u8_t* sysdescr_ptr = (u8_t*)&sysdescr_default[0];
static const u8_t* sysdescr_len_ptr = &sysdescr_len_default;
static const u8_t* sysdescr_ptr = &sysdescr_default[0];
/** mib-2.system.sysContact */
static const u8_t syscontact_len_default = 0;
static const u8_t syscontact_default[] = "";
@@ -902,7 +902,7 @@ static u32_t snmpinpkts = 0,
* @param src points to source
* @param n number of octets to copy.
*/
static void ocstrncpy(u8_t *dst, u8_t *src, u16_t n)
static void ocstrncpy(u8_t *dst, const u8_t *src, u16_t n)
{
u16_t i = n;
while (i > 0) {
@@ -918,7 +918,7 @@ static void ocstrncpy(u8_t *dst, u8_t *src, u16_t n)
* @param src points to source
* @param n number of sub identifiers to copy.
*/
void objectidncpy(s32_t *dst, s32_t *src, u8_t n)
void objectidncpy(s32_t *dst, const s32_t *src, u8_t n)
{
u8_t i = n;
while(i > 0) {
@@ -933,7 +933,7 @@ void objectidncpy(s32_t *dst, s32_t *src, u8_t n)
* @param str if non-NULL then copy str pointer
* @param len points to string length, excluding zero terminator
*/
void snmp_set_sysdesr(u8_t *str, u8_t *len)
void snmp_set_sysdescr(const u8_t *str, const u8_t *len)
{
if (str != NULL)
{

View File

@@ -326,16 +326,34 @@ sys_timeout(u32_t msecs, sys_timeout_handler handler, void *arg)
#endif /* LWIP_DEBUG_TIMERNAMES */
{
struct sys_timeo *timeout, *t;
#if NO_SYS
u32_t now, diff;
#endif
timeout = (struct sys_timeo *)memp_malloc(MEMP_SYS_TIMEOUT);
if (timeout == NULL) {
LWIP_ASSERT("sys_timeout: timeout != NULL, pool MEMP_SYS_TIMEOUT is empty", timeout != NULL);
return;
}
#if NO_SYS
now = sys_now();
if (next_timeout == NULL) {
diff = 0;
timeouts_last_time = now;
} else {
diff = now - timeouts_last_time;
}
#endif
timeout->next = NULL;
timeout->h = handler;
timeout->arg = arg;
#if NO_SYS
timeout->time = msecs + diff;
#else
timeout->time = msecs;
#endif
#if LWIP_DEBUG_TIMERNAMES
timeout->handler_name = handler_name;
LWIP_DEBUGF(TIMERS_DEBUG, ("sys_timeout: %p msecs=%"U32_F" handler=%s arg=%p\n",
@@ -437,7 +455,7 @@ sys_check_timeouts(void)
if (tmptimeout && (tmptimeout->time <= diff)) {
/* timeout has expired */
had_one = 1;
timeouts_last_time = now;
timeouts_last_time += tmptimeout->time;
diff -= tmptimeout->time;
next_timeout = tmptimeout->next;
handler = tmptimeout->h;