Commit 70b0e7c
committed
stm32/eth: Consolidate DHCP restart logic and fix static IP.
Static IP configured before active(True) was being overwritten when MAC
speed/duplex reconfiguration occurred (~2s after link up). The MAC
reconfiguration code restarted DHCP whenever a DHCP struct existed,
without checking if a static IP was configured.
Created eth_dhcp_restart_if_needed() helper function that checks if IP
is 0.0.0.0 before restarting DHCP. Consolidated 3 locations with
duplicated DHCP restart logic to use this helper, reducing code size
by 30 lines while fixing the bug.
This ensures static IP is preserved through MAC reconfiguration, cable
unplug/replug, and interface activation.
Signed-off-by: Andrew Leech <[email protected]>1 parent f329f99 commit 70b0e7c
1 file changed
+16
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
768 | 768 | | |
769 | 769 | | |
770 | 770 | | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
771 | 781 | | |
772 | 782 | | |
773 | 783 | | |
| |||
795 | 805 | | |
796 | 806 | | |
797 | 807 | | |
798 | | - | |
799 | | - | |
800 | | - | |
801 | | - | |
802 | | - | |
803 | | - | |
804 | | - | |
805 | | - | |
| 808 | + | |
| 809 | + | |
806 | 810 | | |
807 | 811 | | |
808 | 812 | | |
| |||
897 | 901 | | |
898 | 902 | | |
899 | 903 | | |
900 | | - | |
| 904 | + | |
901 | 905 | | |
902 | 906 | | |
903 | | - | |
904 | | - | |
905 | | - | |
906 | | - | |
907 | | - | |
| 907 | + | |
908 | 908 | | |
909 | 909 | | |
910 | 910 | | |
| |||
992 | 992 | | |
993 | 993 | | |
994 | 994 | | |
995 | | - | |
996 | | - | |
997 | | - | |
998 | | - | |
999 | | - | |
1000 | | - | |
| 995 | + | |
| 996 | + | |
1001 | 997 | | |
1002 | 998 | | |
1003 | 999 | | |
| |||
0 commit comments