Commit 9dc63a1efd50ab6f792b165dffe176547350bfcc
1 parent
bdaf78e0
Make network packet debug functions more accessible
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5416 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
7 additions
and
4 deletions
vl.c
| ... | ... | @@ -151,6 +151,8 @@ |
| 151 | 151 | |
| 152 | 152 | //#define DEBUG_UNUSED_IOPORT |
| 153 | 153 | //#define DEBUG_IOPORT |
| 154 | +//#define DEBUG_NET | |
| 155 | +//#define DEBUG_SLIRP | |
| 154 | 156 | |
| 155 | 157 | #ifdef TARGET_PPC |
| 156 | 158 | #define DEFAULT_RAM_SIZE 144 |
| ... | ... | @@ -3861,7 +3863,7 @@ void qemu_chr_close(CharDriverState *chr) |
| 3861 | 3863 | /***********************************************************/ |
| 3862 | 3864 | /* network device redirectors */ |
| 3863 | 3865 | |
| 3864 | -__attribute__ (( unused )) | |
| 3866 | +#if defined(DEBUG_NET) || defined(DEBUG_SLIRP) | |
| 3865 | 3867 | static void hex_dump(FILE *f, const uint8_t *buf, int size) |
| 3866 | 3868 | { |
| 3867 | 3869 | int len, i, j, c; |
| ... | ... | @@ -3887,6 +3889,7 @@ static void hex_dump(FILE *f, const uint8_t *buf, int size) |
| 3887 | 3889 | fprintf(f, "\n"); |
| 3888 | 3890 | } |
| 3889 | 3891 | } |
| 3892 | +#endif | |
| 3890 | 3893 | |
| 3891 | 3894 | static int parse_macaddr(uint8_t *macaddr, const char *p) |
| 3892 | 3895 | { |
| ... | ... | @@ -4105,7 +4108,7 @@ void qemu_send_packet(VLANClientState *vc1, const uint8_t *buf, int size) |
| 4105 | 4108 | VLANState *vlan = vc1->vlan; |
| 4106 | 4109 | VLANClientState *vc; |
| 4107 | 4110 | |
| 4108 | -#if 0 | |
| 4111 | +#ifdef DEBUG_NET | |
| 4109 | 4112 | printf("vlan %d send:\n", vlan->id); |
| 4110 | 4113 | hex_dump(stdout, buf, size); |
| 4111 | 4114 | #endif |
| ... | ... | @@ -4130,7 +4133,7 @@ int slirp_can_output(void) |
| 4130 | 4133 | |
| 4131 | 4134 | void slirp_output(const uint8_t *pkt, int pkt_len) |
| 4132 | 4135 | { |
| 4133 | -#if 0 | |
| 4136 | +#ifdef DEBUG_SLIRP | |
| 4134 | 4137 | printf("slirp output:\n"); |
| 4135 | 4138 | hex_dump(stdout, pkt, pkt_len); |
| 4136 | 4139 | #endif |
| ... | ... | @@ -4141,7 +4144,7 @@ void slirp_output(const uint8_t *pkt, int pkt_len) |
| 4141 | 4144 | |
| 4142 | 4145 | static void slirp_receive(void *opaque, const uint8_t *buf, int size) |
| 4143 | 4146 | { |
| 4144 | -#if 0 | |
| 4147 | +#ifdef DEBUG_SLIRP | |
| 4145 | 4148 | printf("slirp input:\n"); |
| 4146 | 4149 | hex_dump(stdout, buf, size); |
| 4147 | 4150 | #endif | ... | ... |