Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:lafenghu
dhcpcd
dhcpcd-3.2.3-renew-unicast.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File dhcpcd-3.2.3-renew-unicast.diff of Package dhcpcd
--- dhcp.c +++ dhcp.c @@ -333,6 +333,22 @@ ssize_t send_message (const interface_t *iface, const dhcp_t *dhcp, message_length = p - m; + if (to.s_addr && to.s_addr != INADDR_BROADCAST) { + struct sockaddr_in sin_to; + + memset(&sin_to, 0, sizeof(sin_to)); + sin_to.sin_family = AF_INET; + sin_to.sin_addr.s_addr = to.s_addr; + sin_to.sin_port = htons(DHCP_SERVER_PORT); + + logger (LOG_DEBUG, "sending %s with xid 0x%x to %s", + dhcp_message (type), xid, inet_ntoa(to)); + + return sendto(iface->listen_fd, + (unsigned char *) message, message_length, + 0, (struct sockaddr *)&sin_to, sizeof(sin_to)); + } + packet = xzalloc (sizeof (*packet)); make_dhcp_packet (packet, (unsigned char *) message, message_length, from, to); @@ -340,6 +356,7 @@ ssize_t send_message (const interface_t *iface, const dhcp_t *dhcp, logger (LOG_DEBUG, "sending %s with xid 0x%x", dhcp_message (type), xid); + retval = send_packet (iface, ETHERTYPE_IP, (unsigned char *) packet, message_length + sizeof (packet->ip) + sizeof (packet->udp)); --- socket.c +++ socket.c @@ -461,8 +461,8 @@ int open_socket (interface_t *iface, int protocol) /* We need to bind to a port, otherwise Linux generate ICMP messages * that cannot contect the port when we have an address. - * We don't actually use this fd at all, instead using our packet - * filter socket. */ + * We actually use this fd for unicast messages only, otherwise we're + * using our packet filter socket. So read it as udp_fd ... */ if (iface->listen_fd == -1 && protocol == ETHERTYPE_IP) { if ((fd = socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) { logger (LOG_ERR, "socket: %s", strerror (errno));
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor