Browse Source

udhcp: reuse strings

   text	   data	    bss	    dec	    hex	filename
1019916	    559	   5020	1025495	  fa5d7	busybox_old
1019906	    559	   5020	1025485	  fa5cd	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko 3 years ago
parent
commit
a4959eef71
3 changed files with 14 additions and 10 deletions
  1. 8 6
      networking/udhcp/d6_dhcpc.c
  2. 4 2
      networking/udhcp/dhcpc.c
  3. 2 2
      networking/udhcp/dhcpd.c

+ 8 - 6
networking/udhcp/d6_dhcpc.c

@@ -1589,8 +1589,10 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
 		}
 
 		if ((packet.d6_xid32 & htonl(0x00ffffff)) != xid) {
-			log1("xid %x (our is %x), ignoring packet",
-				(unsigned)(packet.d6_xid32 & htonl(0x00ffffff)), (unsigned)xid);
+			log1("xid %x (our is %x)%s",
+				(unsigned)(packet.d6_xid32 & htonl(0x00ffffff)), (unsigned)xid,
+				", ignoring packet"
+			);
 			continue;
 		}
 
@@ -1743,7 +1745,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
 					free(client6_data.ia_na);
 					client6_data.ia_na = d6_copy_option(packet.d6_options, packet_end, D6_OPT_IA_NA);
 					if (!client6_data.ia_na) {
-						bb_info_msg("no %s option, ignoring packet", "IA_NA");
+						bb_info_msg("no %s option%s", "IA_NA", ", ignoring packet");
 						continue;
 					}
 					if (client6_data.ia_na->len < (4 + 4 + 4) + (2 + 2 + 16 + 4 + 4)) {
@@ -1756,7 +1758,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
 							D6_OPT_IAADDR
 					);
 					if (!iaaddr) {
-						bb_info_msg("no %s option, ignoring packet", "IAADDR");
+						bb_info_msg("no %s option%s", "IAADDR", ", ignoring packet");
 						continue;
 					}
 					if (iaaddr->len < (16 + 4 + 4)) {
@@ -1781,7 +1783,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
 					free(client6_data.ia_pd);
 					client6_data.ia_pd = d6_copy_option(packet.d6_options, packet_end, D6_OPT_IA_PD);
 					if (!client6_data.ia_pd) {
-						bb_info_msg("no %s option, ignoring packet", "IA_PD");
+						bb_info_msg("no %s option%s", "IA_PD", ", ignoring packet");
 						continue;
 					}
 					if (client6_data.ia_pd->len < (4 + 4 + 4) + (2 + 2 + 4 + 4 + 1 + 16)) {
@@ -1794,7 +1796,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
 							D6_OPT_IAPREFIX
 					);
 					if (!iaprefix) {
-						bb_info_msg("no %s option, ignoring packet", "IAPREFIX");
+						bb_info_msg("no %s option%s", "IAPREFIX", ", ignoring packet");
 						continue;
 					}
 					if (iaprefix->len < (4 + 4 + 1 + 16)) {

+ 4 - 2
networking/udhcp/dhcpc.c

@@ -1655,8 +1655,10 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
 		}
 
 		if (packet.xid != xid) {
-			log1("xid %x (our is %x), ignoring packet",
-				(unsigned)packet.xid, (unsigned)xid);
+			log1("xid %x (our is %x)%s",
+				(unsigned)packet.xid, (unsigned)xid,
+				", ignoring packet"
+			);
 			continue;
 		}
 

+ 2 - 2
networking/udhcp/dhcpd.c

@@ -1048,7 +1048,7 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
 			move_from_unaligned32(server_id_network_order, server_id_opt);
 			if (server_id_network_order != server_data.server_nip) {
 				/* client talks to somebody else */
-				log1("server ID doesn't match%s", ", ignoring");
+				log1("server ID doesn't match%s", ", ignoring packet");
 				continue;
 			}
 		}
@@ -1171,7 +1171,7 @@ o DHCPREQUEST generated during REBINDING state:
 			if (!requested_ip_opt) {
 				requested_nip = packet.ciaddr;
 				if (requested_nip == 0) {
-					log1("no requested IP and no ciaddr%s", ", ignoring");
+					log1("no requested IP and no ciaddr%s", ", ignoring packet");
 					break;
 				}
 			}