diff options
-rw-r--r-- | networking/udhcp/d6_dhcpc.c | 28 | ||||
-rw-r--r-- | networking/udhcp/dhcpc.h | 6 | ||||
-rw-r--r-- | networking/udhcp/dhcpd.h | 6 |
3 files changed, 22 insertions, 18 deletions
diff --git a/networking/udhcp/d6_dhcpc.c b/networking/udhcp/d6_dhcpc.c index c44220bf9..b0f0798e5 100644 --- a/networking/udhcp/d6_dhcpc.c +++ b/networking/udhcp/d6_dhcpc.c | |||
@@ -311,8 +311,8 @@ static int d6_mcast_from_client_config_ifindex(struct d6_packet *packet, uint8_t | |||
311 | 311 | ||
312 | return d6_send_raw_packet( | 312 | return d6_send_raw_packet( |
313 | packet, (end - (uint8_t*) packet), | 313 | packet, (end - (uint8_t*) packet), |
314 | /*src*/ NULL, CLIENT_PORT, | 314 | /*src*/ NULL, CLIENT_PORT6, |
315 | /*dst*/ (struct in6_addr*)FF02__1_2, SERVER_PORT, MAC_BCAST_ADDR, | 315 | /*dst*/ (struct in6_addr*)FF02__1_2, SERVER_PORT6, MAC_BCAST_ADDR, |
316 | client_config.ifindex | 316 | client_config.ifindex |
317 | ); | 317 | ); |
318 | } | 318 | } |
@@ -554,8 +554,8 @@ static NOINLINE int send_d6_renew(uint32_t xid, struct in6_addr *server_ipv6, st | |||
554 | if (server_ipv6) | 554 | if (server_ipv6) |
555 | return d6_send_kernel_packet( | 555 | return d6_send_kernel_packet( |
556 | &packet, (opt_ptr - (uint8_t*) &packet), | 556 | &packet, (opt_ptr - (uint8_t*) &packet), |
557 | our_cur_ipv6, CLIENT_PORT, | 557 | our_cur_ipv6, CLIENT_PORT6, |
558 | server_ipv6, SERVER_PORT | 558 | server_ipv6, SERVER_PORT6 |
559 | ); | 559 | ); |
560 | return d6_mcast_from_client_config_ifindex(&packet, opt_ptr); | 560 | return d6_mcast_from_client_config_ifindex(&packet, opt_ptr); |
561 | } | 561 | } |
@@ -576,8 +576,8 @@ static int send_d6_release(struct in6_addr *server_ipv6, struct in6_addr *our_cu | |||
576 | bb_info_msg("Sending release..."); | 576 | bb_info_msg("Sending release..."); |
577 | return d6_send_kernel_packet( | 577 | return d6_send_kernel_packet( |
578 | &packet, (opt_ptr - (uint8_t*) &packet), | 578 | &packet, (opt_ptr - (uint8_t*) &packet), |
579 | our_cur_ipv6, CLIENT_PORT, | 579 | our_cur_ipv6, CLIENT_PORT6, |
580 | server_ipv6, SERVER_PORT | 580 | server_ipv6, SERVER_PORT6 |
581 | ); | 581 | ); |
582 | } | 582 | } |
583 | 583 | ||
@@ -614,7 +614,7 @@ static NOINLINE int d6_recv_raw_packet(struct in6_addr *peer_ipv6 | |||
614 | /* make sure its the right packet for us, and that it passes sanity checks */ | 614 | /* make sure its the right packet for us, and that it passes sanity checks */ |
615 | if (packet.ip6.ip6_nxt != IPPROTO_UDP | 615 | if (packet.ip6.ip6_nxt != IPPROTO_UDP |
616 | || (packet.ip6.ip6_vfc >> 4) != 6 | 616 | || (packet.ip6.ip6_vfc >> 4) != 6 |
617 | || packet.udp.dest != htons(CLIENT_PORT) | 617 | || packet.udp.dest != htons(CLIENT_PORT6) |
618 | /* || bytes > (int) sizeof(packet) - can't happen */ | 618 | /* || bytes > (int) sizeof(packet) - can't happen */ |
619 | || packet.udp.len != packet.ip6.ip6_plen | 619 | || packet.udp.len != packet.ip6.ip6_plen |
620 | ) { | 620 | ) { |
@@ -708,7 +708,7 @@ static int d6_raw_socket(int ifindex) | |||
708 | BPF_STMT(BPF_LDX|BPF_B|BPF_MSH, 0), | 708 | BPF_STMT(BPF_LDX|BPF_B|BPF_MSH, 0), |
709 | /* load udp destination port from halfword[header_len + 2] */ | 709 | /* load udp destination port from halfword[header_len + 2] */ |
710 | BPF_STMT(BPF_LD|BPF_H|BPF_IND, 2), | 710 | BPF_STMT(BPF_LD|BPF_H|BPF_IND, 2), |
711 | /* jump to L3 if udp dport is CLIENT_PORT, else to L4 */ | 711 | /* jump to L3 if udp dport is CLIENT_PORT6, else to L4 */ |
712 | BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, 68, 0, 1), | 712 | BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, 68, 0, 1), |
713 | /* L3: accept packet */ | 713 | /* L3: accept packet */ |
714 | BPF_STMT(BPF_RET|BPF_K, 0xffffffff), | 714 | BPF_STMT(BPF_RET|BPF_K, 0xffffffff), |
@@ -733,7 +733,7 @@ static int d6_raw_socket(int ifindex) | |||
733 | xbind(fd, (struct sockaddr *) &sock, sizeof(sock)); | 733 | xbind(fd, (struct sockaddr *) &sock, sizeof(sock)); |
734 | 734 | ||
735 | #if 0 | 735 | #if 0 |
736 | if (CLIENT_PORT == 68) { | 736 | if (CLIENT_PORT6 == 546) { |
737 | /* Use only if standard port is in use */ | 737 | /* Use only if standard port is in use */ |
738 | /* Ignoring error (kernel may lack support for this) */ | 738 | /* Ignoring error (kernel may lack support for this) */ |
739 | if (setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, &filter_prog, | 739 | if (setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, &filter_prog, |
@@ -761,7 +761,7 @@ static void change_listen_mode(int new_mode) | |||
761 | sockfd = -1; | 761 | sockfd = -1; |
762 | } | 762 | } |
763 | if (new_mode == LISTEN_KERNEL) | 763 | if (new_mode == LISTEN_KERNEL) |
764 | sockfd = udhcp_listen_socket(/*INADDR_ANY,*/ CLIENT_PORT, client_config.interface); | 764 | sockfd = udhcp_listen_socket(/*INADDR_ANY,*/ CLIENT_PORT6, client_config.interface); |
765 | else if (new_mode != LISTEN_NONE) | 765 | else if (new_mode != LISTEN_NONE) |
766 | sockfd = d6_raw_socket(client_config.ifindex); | 766 | sockfd = d6_raw_socket(client_config.ifindex); |
767 | /* else LISTEN_NONE: sockfd stays closed */ | 767 | /* else LISTEN_NONE: sockfd stays closed */ |
@@ -931,8 +931,8 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv) | |||
931 | fd_set rfds; | 931 | fd_set rfds; |
932 | 932 | ||
933 | /* Default options */ | 933 | /* Default options */ |
934 | IF_FEATURE_UDHCP_PORT(SERVER_PORT = 547;) | 934 | IF_FEATURE_UDHCP_PORT(SERVER_PORT6 = 547;) |
935 | IF_FEATURE_UDHCP_PORT(CLIENT_PORT = 546;) | 935 | IF_FEATURE_UDHCP_PORT(CLIENT_PORT6 = 546;) |
936 | client_config.interface = "eth0"; | 936 | client_config.interface = "eth0"; |
937 | client_config.script = CONFIG_UDHCPC_DEFAULT_SCRIPT; | 937 | client_config.script = CONFIG_UDHCPC_DEFAULT_SCRIPT; |
938 | 938 | ||
@@ -961,8 +961,8 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv) | |||
961 | } | 961 | } |
962 | #if ENABLE_FEATURE_UDHCP_PORT | 962 | #if ENABLE_FEATURE_UDHCP_PORT |
963 | if (opt & OPT_P) { | 963 | if (opt & OPT_P) { |
964 | CLIENT_PORT = xatou16(str_P); | 964 | CLIENT_PORT6 = xatou16(str_P); |
965 | SERVER_PORT = CLIENT_PORT - 1; | 965 | SERVER_PORT6 = CLIENT_PORT6 + 1; |
966 | } | 966 | } |
967 | #endif | 967 | #endif |
968 | while (list_O) { | 968 | while (list_O) { |
diff --git a/networking/udhcp/dhcpc.h b/networking/udhcp/dhcpc.h index 2859a0772..9f423a5b2 100644 --- a/networking/udhcp/dhcpc.h +++ b/networking/udhcp/dhcpc.h | |||
@@ -29,9 +29,11 @@ struct client_config_t { | |||
29 | #define client_config (*(struct client_config_t*)(&bb_common_bufsiz1[COMMON_BUFSIZE / 2])) | 29 | #define client_config (*(struct client_config_t*)(&bb_common_bufsiz1[COMMON_BUFSIZE / 2])) |
30 | 30 | ||
31 | #if ENABLE_FEATURE_UDHCP_PORT | 31 | #if ENABLE_FEATURE_UDHCP_PORT |
32 | #define CLIENT_PORT (client_config.port) | 32 | #define CLIENT_PORT (client_config.port) |
33 | #define CLIENT_PORT6 (client_config.port) | ||
33 | #else | 34 | #else |
34 | #define CLIENT_PORT 68 | 35 | #define CLIENT_PORT 68 |
36 | #define CLIENT_PORT6 546 | ||
35 | #endif | 37 | #endif |
36 | 38 | ||
37 | POP_SAVED_FUNCTION_VISIBILITY | 39 | POP_SAVED_FUNCTION_VISIBILITY |
diff --git a/networking/udhcp/dhcpd.h b/networking/udhcp/dhcpd.h index 7c801bf6b..a77724f20 100644 --- a/networking/udhcp/dhcpd.h +++ b/networking/udhcp/dhcpd.h | |||
@@ -61,9 +61,11 @@ struct server_config_t { | |||
61 | /* client_config sits in 2nd half of bb_common_bufsiz1 */ | 61 | /* client_config sits in 2nd half of bb_common_bufsiz1 */ |
62 | 62 | ||
63 | #if ENABLE_FEATURE_UDHCP_PORT | 63 | #if ENABLE_FEATURE_UDHCP_PORT |
64 | #define SERVER_PORT (server_config.port) | 64 | #define SERVER_PORT (server_config.port) |
65 | #define SERVER_PORT6 (server_config.port) | ||
65 | #else | 66 | #else |
66 | #define SERVER_PORT 67 | 67 | #define SERVER_PORT 67 |
68 | #define SERVER_PORT6 547 | ||
67 | #endif | 69 | #endif |
68 | 70 | ||
69 | 71 | ||