Esempio n. 1
0
static int uip_switch2port_xfer(struct vmm_netport *port,
			 	struct vmm_mbuf *mbuf)
{
	struct uip_port_state *s = &uip_port_state;
	int rc = VMM_OK;
	unsigned long flags;
#ifdef UIP_DEBUG
	char tname[30];
#endif
	u8 *dstmac = ether_dstmac(mtod(mbuf, u8 *));
	/* do not accept frames which do not have either 
	 * our MAC or broadcast MAC */
	DPRINTF("UIP received frame with MAC[%s]",
			ethaddr_to_str(tname, srcmac));
	if(compare_ether_addr(dstmac, port->macaddr)
		&& !is_broadcast_ether_addr(dstmac)) {
		/* Reject packets addressed for someone else */
		DPRINTF("  and rejected \n");
		return VMM_EFAIL;
	} else {
		DPRINTF("  and accepted \n");
	}	
	vmm_spin_lock_irqsave(&s->lock, flags);
	list_add_tail(&mbuf->m_list, &s->rxbuf);
	vmm_spin_unlock_irqrestore(&s->lock, flags);
	vmm_completion_complete(&s->rx_possible);

	return rc;
}
Esempio n. 2
0
static int cmd_ipconfig_show(struct vmm_chardev *cdev, int argc, char **argv)
{
	u8 buf[4];
	char str[30];
	char *p;

	vmm_cprintf(cdev, "Network stack Configuration:\n");
	p = netstack_get_name();
	vmm_cprintf(cdev, "   TCP/IP stack name  : %s\n", p);
	netstack_get_ipaddr(buf);
	p = ip4addr_to_str(str, buf);
	vmm_cprintf(cdev, "   IP address         : %s\n", p);
	netstack_get_ipmask(buf);
	p = ip4addr_to_str(str, buf);
	vmm_cprintf(cdev, "   IP netmask         : %s\n", p);
	netstack_get_gatewayip(buf);
	p = ip4addr_to_str(str, buf);
	vmm_cprintf(cdev, "   Gateway IP address : %s\n", p);
	netstack_get_hwaddr(buf);
	p = ethaddr_to_str(str, buf);
	vmm_cprintf(cdev, "   HW address         : %s\n", p);

	return VMM_OK;
}