Initialize the new members of struct ip_moptions as

a defensive programming measure.

Note that whilst these members are not used by the ip_output()
path, we are passing an instance of struct ip_moptions here
which is declared on the stack (which could be considered a
bad thing).

ip_output() does not consume struct ip_moptions, but in case it
does in future, declare an in_multi vector on the stack too to
behave more like ip_findmoptions() does.
This commit is contained in:
Bruce M Simpson 2006-05-18 19:51:08 +00:00
parent c5ee6cb09e
commit 8d7d85149e

View File

@ -2116,6 +2116,7 @@ tbf_send_packet(struct vif *vifp, struct mbuf *m)
ip_output(m, NULL, &vifp->v_route, IP_FORWARDING, NULL, NULL);
else {
struct ip_moptions imo;
struct in_multi *imm[2];
int error;
static struct route ro; /* XXX check this */
@ -2123,6 +2124,9 @@ tbf_send_packet(struct vif *vifp, struct mbuf *m)
imo.imo_multicast_ttl = mtod(m, struct ip *)->ip_ttl - 1;
imo.imo_multicast_loop = 1;
imo.imo_multicast_vif = -1;
imo.imo_num_memberships = 0;
imo.imo_max_memberships = 2;
imo.imo_membership = &imm[0];
/*
* Re-entrancy should not be a problem here, because