net: net_if: avoid deref of NULL L2
net: net_if: avoid deref of NULL L2

When using offloaded network, an L2 is never assigned to the net_if.
Only certain portions of the net_if code are referenced such as:
net_if_up()
net_if_down()

And these functions make use of several L2 references:
get_flags()
enable()

Let's add checks to make sure we don't deref a NULL when using these
functions.

Fixes the following exception on K64F and other HW which can make
use of offloaded network HW:
FATAL: ***** Reserved Exception ( -16) *****
FATAL: r0/a1:  0x00000010  r1/a2:  0x0000644f  r2/a3:  0x00000000
FATAL: r3/a4:  0x00000000 r12/ip:  0x2000474c r14/lr:  0x0001475b
FATAL:  xpsr:  0x00000000
FATAL: Faulting instruction address (r15/pc): 0x0001b1cd
FATAL: >>> ZEPHYR FATAL ERROR 0: CPU exception
FATAL: Current thread: 0x20004c4c (unknown)

Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/18957

Signed-off-by: Michael Scott <a17fed27eaa842282862ff7c1b9c8395a26ac320@foundries.io>

finikorg/zephyr,nashif/zephyr,nashif/zephyr,galak/zephyr,finikorg/zephyr,galak/zephyr,zephyrproject-rtos/zephyr,galak/zephyr,nashif/zephyr,Vudentz/zephyr,finikorg/zephyr,zephyrproject-rtos/zephyr,zephyrproject-rtos/zephyr,finikorg/zephyr,Vudentz/zephyr,Vudentz/zephyr,Vudentz/zephyr,zephyrproject-rtos/zephyr,galak/zephyr,Vudentz/zephyr,Vudentz/zephyr,finikorg/zephyr,nashif/zephyr,nashif/zephyr,zephyrproject-rtos/zephyr,galak/zephyr