Commit-ID: 1cef252aeb2cdb5a3d3b6f6603e8831b938a1964 Gitweb: http://git.kernel.org/tip/1cef252aeb2cdb5a3d3b6f6603e8831b938a1964 Author: Asias He <asias.hejun@xxxxxxxxx> AuthorDate: Sun, 17 Jul 2011 16:56:56 +0800 Committer: Pekka Enberg <penberg@xxxxxxxxxx> CommitDate: Mon, 18 Jul 2011 13:17:12 +0300 kvm tools: Introduce uip_dhcp_make_pkg() This patch cooks a DHCP package. Signed-off-by: Asias He <asias.hejun@xxxxxxxxx> Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx> --- tools/kvm/net/uip/dhcp.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/tools/kvm/net/uip/dhcp.c b/tools/kvm/net/uip/dhcp.c index b4df37f..7ee55e5 100644 --- a/tools/kvm/net/uip/dhcp.c +++ b/tools/kvm/net/uip/dhcp.c @@ -133,3 +133,25 @@ static int uip_dhcp_fill_option(struct uip_info *info, struct uip_dhcp *dhcp, in return 0; } + +static int uip_dhcp_make_pkg(struct uip_info *info, struct uip_udp_socket *sk, struct uip_buf *buf, u8 reply_msg_type) +{ + struct uip_dhcp *dhcp; + + dhcp = (struct uip_dhcp *)buf->eth; + + dhcp->msg_type = 2; + dhcp->client_ip = 0; + dhcp->your_ip = htonl(info->guest_ip); + dhcp->server_ip = htonl(info->host_ip); + dhcp->agent_ip = 0; + + uip_dhcp_fill_option(info, dhcp, reply_msg_type); + + sk->sip = htonl(info->guest_ip); + sk->dip = htonl(info->host_ip); + sk->sport = htons(UIP_DHCP_PORT_CLIENT); + sk->dport = htons(UIP_DHCP_PORT_SERVER); + + return 0; +} -- To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
![]() |