Fixed debug output.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5275 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Waldemar Kornewald
2003-11-07 15:43:30 +00:00
parent e8e6c3e8ad
commit 7072f4d0dc
2 changed files with 22 additions and 16 deletions
+4 -4
View File
@@ -304,16 +304,16 @@ void m_copydata(struct mbuf *m, int off, int len, caddr_t cp)
uint count = 0; uint count = 0;
if (off < 0) { if (off < 0) {
printf("m_copydata: off %d < 0", off); printf("m_copydata: off %d < 0\n", off);
return; return;
} }
if (len < 0) { if (len < 0) {
printf("m_copydata: len %d < 0", len); printf("m_copydata: len %d < 0\n", len);
return; return;
} }
while (off > 0) { while (off > 0) {
if (m == NULL) { if (m == NULL) {
printf("m_copydata: null mbuf in skip"); printf("m_copydata: null mbuf in skip\n");
return; return;
} }
if (off < (int) m->m_len) if (off < (int) m->m_len)
@@ -323,7 +323,7 @@ void m_copydata(struct mbuf *m, int off, int len, caddr_t cp)
} }
while (len > 0) { while (len > 0) {
if (m == NULL) { if (m == NULL) {
printf("m_copydata: null mbuf"); printf("m_copydata: null mbuf\n");
return; return;
} }
count = min((int) m->m_len - off, len); count = min((int) m->m_len - off, len);
@@ -289,21 +289,19 @@ static void find_devices(void)
return; return;
} }
#if SHOW_DEBUG #if DEBUG
static void dump_ether_details(struct mbuf *buf) static void dump_ether_details(struct mbuf *buf)
{ {
struct ether_header *eth = mtod(buf, struct ether_header *); struct ether_header *eth = mtod(buf, struct ether_header *);
printf("Ethernet packet from "); printf("Ethernet packet from %s", ether_sprintf(eth->ether_shost));
print_ether_addr(&eth->src); printf(" to %s", ether_sprintf(eth->ether_dhost));
printf(" to ");
print_ether_addr(&eth->dest);
if (buf->m_flags & M_BCAST) if (buf->m_flags & M_BCAST)
printf(" BCAST"); printf(" BCAST");
printf(" proto "); printf(" proto ");
switch (eth->type) { switch (eth->ether_type) {
case ETHER_ARP: case ETHER_ARP:
printf("ARP\n"); printf("ARP\n");
break; break;
@@ -316,8 +314,16 @@ static void dump_ether_details(struct mbuf *buf)
case ETHER_IPV6: case ETHER_IPV6:
printf("IPv6\n"); printf("IPv6\n");
break; break;
case ETHER_PPPOE_DISC:
printf("PPPoE Discovery\n");
break;
case ETHER_PPPOE_SESS:
printf("PPPoE Session\n");
break;
default: default:
printf("unknown (%04x)\n", eth->type); printf("unknown (%04x)\n", eth->ether_type);
} }
} }
#endif #endif
@@ -343,8 +349,8 @@ int32 ether_input(void *data)
if (eth->ether_dhost[0] & 1) if (eth->ether_dhost[0] & 1)
m->m_flags |= M_MCAST; m->m_flags |= M_MCAST;
#if SHOW_DEBUG #if DEBUG
dump_ether_details(buf); dump_ether_details(m);
#endif #endif
// as PPPoE needs the ethernet header we process it before m_adj // as PPPoE needs the ethernet header we process it before m_adj
if(eth->ether_type == ETHERTYPE_PPPOEDISC if(eth->ether_type == ETHERTYPE_PPPOEDISC