busybox/networking/udhcp
Michal Kazior b817699e6c udhcp: bind to device even for ucast packets
There are cases where binding to source IP and
destination IP is insufficient to guarantee sane
xmit netdev.

One case where this can fail is when
route-matching netdev carrier is down (cable
unplugged, wifi disconnected), or the netdev is
admin down. Then all the IP based bindings (bind()
+ connect()) will seemingly succeed but the actual
packet can go out through a default gw path.

Depending on the network this happens on
it can create issues or false alarms. It can
also leak some subnet info across networks that
shouldn't be routed.

As such better be safe than sorry and bind to a
netdev to be sure it's used for xmit.

function                                             old     new   delta
udhcp_send_kernel_packet                             293     336     +43
send_packet                                          182     188      +6
bcast_or_ucast                                        37      43      +6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 55/0)               Total: 55 bytes

Signed-off-by: Michal Kazior <michal@plume.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-15 21:44:21 +01:00
..
arpping.c libbb: reduce the overhead of single parameter bb_error_msg() calls 2019-07-02 11:35:03 +02:00
common.c avoid using strok - eliminates use of hidden global variable 2020-10-06 02:36:47 +02:00
common.h udhcp: bind to device even for ucast packets 2020-12-15 21:44:21 +01:00
Config.src build system: drop PLATFORM_LINUX 2020-08-13 17:12:56 +02:00
d6_common.h udhcpc6: s/iphdr/ip6_hdr/ 2019-08-09 20:43:40 +02:00
d6_dhcpc.c gcc-9.x warning fixes 2020-10-01 03:07:22 +02:00
d6_packet.c gcc-9.x warning fixes 2020-10-01 03:07:22 +02:00
d6_socket.c libbb: reduce the overhead of single parameter bb_error_msg() calls 2019-07-02 11:35:03 +02:00
dhcpc.c udhcp: bind to device even for ucast packets 2020-12-15 21:44:21 +01:00
dhcpc.h udhcpc: add support for long options 2020-08-13 16:48:07 +02:00
dhcpd.c udhcp: bind to device even for ucast packets 2020-12-15 21:44:21 +01:00
dhcpd.h udhcp: rename server_config to server_data 2019-05-30 16:23:34 +02:00
dhcprelay.c libbb: reduce the overhead of single parameter bb_error_msg() calls 2019-07-02 11:35:03 +02:00
domain_codec.c domain_codec: optimize dname_dec and convert_dname 2020-07-12 21:19:13 +02:00
dumpleases.c getopt32: remove opt_complementary 2017-08-08 21:55:02 +02:00
Kbuild.src fix breakage found by mass one-applet builds 2016-12-23 02:42:26 +01:00
packet.c udhcp: bind to device even for ucast packets 2020-12-15 21:44:21 +01:00
signalpipe.c libbb: reduce the overhead of single parameter bb_error_msg() calls 2019-07-02 11:35:03 +02:00
socket.c libbb: reduce the overhead of single parameter bb_error_msg() calls 2019-07-02 11:35:03 +02:00