+bool gw_is_target(struct sk_buff *skb) +{
- struct ethhdr *ethhdr;
- struct iphdr *iphdr;
- struct udphdr *udphdr;
- if (atomic_read(&gw_mode) != GW_MODE_CLIENT)
return false;
- if (!curr_gateway)
return false;
- ethhdr = (struct ethhdr *)skb->data;
- if (ntohs(ethhdr->h_proto) != ETH_P_IP)
return false;
- iphdr = (struct iphdr *)(skb->data + ETH_HLEN);
- if (iphdr->protocol != IPPROTO_UDP)
return false;
- udphdr = (struct udphdr *)(skb->data + ETH_HLEN + (iphdr->ihl * 4));
- if (ntohs(udphdr->dest) != 67)
return false;
- return true;
+}
- /* ethernet packet should be broadcasted */
- if (is_bcast(ethhdr->h_dest) || is_mcast(ethhdr->h_dest)) {
- if (is_bcast(ethhdr->h_dest) || is_mcast(ethhdr->h_dest))
bcast_dst = true;
- if ((bcast_dst) && gw_is_target(skb))
do_bcast = false;
Say the DHCP server is running in client mode. It has also been requested to broadcast its replies, not unicast the replies.
http://blogs.technet.com/teamdhcp/archive/2009/02/12/dhcp-broadcast-flag-han...
If i'm reading this code correctly, it will end up sending the DHCP reply messages by unicast to the best gateway, not the DHCP client?
Andrew