The NetBSD Project

CVS log for src/sys/net/if_ethersubr.c

[BACK] Up to [cvs.NetBSD.org] / src / sys / net

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: MAIN


Revision 1.326 / (download) - annotate - [select for diffs], Thu Nov 2 09:40:47 2023 UTC (5 months, 2 weeks ago) by yamaguchi
Branch: MAIN
CVS Tags: thorpej-altq-separation-base, HEAD
Branch point for: thorpej-altq-separation
Changes since 1.325: +4 -3 lines
Diff to previous 1.325 (colored) to selected 1.115 (colored)

Use ether_bpf_mtap only when the device supports vlan harware tagging

The function is bpf_mtap() for ethernet devices and *currently*
it is just handling VLAN tag stripped by the hardware.

Revision 1.325 / (download) - annotate - [select for diffs], Thu Nov 2 09:36:27 2023 UTC (5 months, 2 weeks ago) by yamaguchi
Branch: MAIN
Changes since 1.324: +3 -3 lines
Diff to previous 1.324 (colored) to selected 1.115 (colored)

Added NULL check

Revision 1.324 / (download) - annotate - [select for diffs], Fri Oct 20 08:35:09 2023 UTC (5 months, 3 weeks ago) by msaitoh
Branch: MAIN
Changes since 1.323: +6 -2 lines
Diff to previous 1.323 (colored) to selected 1.115 (colored)

Print error message when the multicast bit is set in the MAC address.

Revision 1.323 / (download) - annotate - [select for diffs], Tue Nov 15 10:47:39 2022 UTC (17 months ago) by roy
Branch: MAIN
CVS Tags: netbsd-10-base
Branch point for: netbsd-10
Changes since 1.322: +15 -2 lines
Diff to previous 1.322 (colored) to selected 1.115 (colored)

arp: Validate ARP source hardware address matches Ethernet source

RFC 5227 section 1.1 states that for a DaD ARP probe the sender hardware
address must match the hardware address of the interface sending the
packet.

We can now verify this by checking the mbuf tag PACKET_TAG_ETHERNET_SRC.

This fixes an obsure issue where an old router was sending out bogus
ARP probes.

Thanks to Ryo Shimizu <ryo@nerv.org> for the re-implementation.

Revision 1.322 / (download) - annotate - [select for diffs], Tue Nov 15 09:14:28 2022 UTC (17 months ago) by roy
Branch: MAIN
Changes since 1.321: +2 -6 lines
Diff to previous 1.321 (colored) to selected 1.115 (colored)

Revert prior.

Revision 1.321 / (download) - annotate - [select for diffs], Mon Nov 14 09:23:42 2022 UTC (17 months ago) by roy
Branch: MAIN
Changes since 1.320: +6 -2 lines
Diff to previous 1.320 (colored) to selected 1.115 (colored)

net: Store a pointer to the Layer 2 Sender Hardware address in mbuf

The BSD networking stack is designed around passing a mbuf down the chain
and each layer removes the part it's interested in before passing it to
the next. This makes it easy for each layer to do it's work,
but non trivial to work backwards.

As such we now store a pointer to the Senders Hardware address in the
mbuf packet header so that protocols can perform any required validation.

Revision 1.320 / (download) - annotate - [select for diffs], Sat Sep 3 02:47:59 2022 UTC (19 months, 1 week ago) by thorpej
Branch: MAIN
CVS Tags: bouyer-sunxi-drm-base, bouyer-sunxi-drm
Changes since 1.319: +2 -3 lines
Diff to previous 1.319 (colored) to selected 1.115 (colored)

Garbage-collect the remaining vestiges of netisr.

Revision 1.319 / (download) - annotate - [select for diffs], Sat Sep 3 02:24:59 2022 UTC (19 months, 1 week ago) by thorpej
Branch: MAIN
Changes since 1.318: +7 -19 lines
Diff to previous 1.318 (colored) to selected 1.115 (colored)

Convert MPLS from a legacy netisr to pktqueue.

Revision 1.318 / (download) - annotate - [select for diffs], Sat Sep 3 01:48:22 2022 UTC (19 months, 1 week ago) by thorpej
Branch: MAIN
Changes since 1.317: +9 -10 lines
Diff to previous 1.317 (colored) to selected 1.115 (colored)

Convert NETATALK from a legacy netisr to pktqueue.

Revision 1.317 / (download) - annotate - [select for diffs], Sat Sep 3 01:35:03 2022 UTC (19 months, 1 week ago) by thorpej
Branch: MAIN
Changes since 1.316: +3 -4 lines
Diff to previous 1.316 (colored) to selected 1.115 (colored)

Convert ARP from a legacy netisr to pktqueue.

Revision 1.316 / (download) - annotate - [select for diffs], Sat Sep 3 00:31:02 2022 UTC (19 months, 1 week ago) by thorpej
Branch: MAIN
Changes since 1.315: +8 -3 lines
Diff to previous 1.315 (colored) to selected 1.115 (colored)

Only use configured RPS hash functions for IPv4 and IPv6 packets.

This is NFC change now because only IPv4 and IPv6 use pktqueue,
but that will change in future commits.

Revision 1.315 / (download) - annotate - [select for diffs], Mon Jun 20 12:22:00 2022 UTC (21 months, 3 weeks ago) by martin
Branch: MAIN
Changes since 1.314: +4 -2 lines
Diff to previous 1.314 (colored) to selected 1.115 (colored)

Avoid unused variable

Revision 1.314 / (download) - annotate - [select for diffs], Mon Jun 20 08:20:09 2022 UTC (21 months, 3 weeks ago) by yamaguchi
Branch: MAIN
Changes since 1.313: +34 -2 lines
Diff to previous 1.313 (colored) to selected 1.115 (colored)

 bpf(4): added support for VLAN hardware offloading of ethernet devices

Revision 1.313 / (download) - annotate - [select for diffs], Mon Jun 20 08:14:48 2022 UTC (21 months, 3 weeks ago) by yamaguchi
Branch: MAIN
Changes since 1.312: +118 -17 lines
Diff to previous 1.312 (colored) to selected 1.115 (colored)

bridge(4): support VLAN frames stripped by hardware tagging

Revision 1.312 / (download) - annotate - [select for diffs], Mon Jun 20 08:02:25 2022 UTC (21 months, 3 weeks ago) by yamaguchi
Branch: MAIN
Changes since 1.311: +55 -55 lines
Diff to previous 1.311 (colored) to selected 1.115 (colored)

Handling frames that vlan id is 0 as non-VLAN frames
even if a vlan tag is stripped by harware offloading

Revision 1.311 / (download) - annotate - [select for diffs], Mon Apr 4 06:10:00 2022 UTC (2 years ago) by yamaguchi
Branch: MAIN
Changes since 1.310: +5 -26 lines
Diff to previous 1.310 (colored) to selected 1.115 (colored)

Move input processing of lagg(4) before ether_input
to get rid of dependence.

This implementation is similar with that of bridge(4).

Revision 1.310 / (download) - annotate - [select for diffs], Fri Dec 31 14:26:09 2021 UTC (2 years, 3 months ago) by riastradh
Branch: MAIN
Changes since 1.309: +4 -2 lines
Diff to previous 1.309 (colored) to selected 1.115 (colored)

ethersubr(9): Assert IFNET_LOCKED in ether_ioctl_reinit.

Changes to if_flags are nontrivial configuration changes that require
the long-term ioctl lock.

Revision 1.309 / (download) - annotate - [select for diffs], Fri Dec 31 14:25:24 2021 UTC (2 years, 3 months ago) by riastradh
Branch: MAIN
Changes since 1.308: +7 -7 lines
Diff to previous 1.308 (colored) to selected 1.115 (colored)

sys: Use if_init wrapper function.

Exception: Not in kern_pmf.c, for the kind of silly reason that it
avoids having kern_pmf.c refer to symbols defined only in net; this
avoids a pain in the rump.

Revision 1.308 / (download) - annotate - [select for diffs], Fri Dec 31 14:24:38 2021 UTC (2 years, 3 months ago) by riastradh
Branch: MAIN
Changes since 1.307: +3 -3 lines
Diff to previous 1.307 (colored) to selected 1.115 (colored)

sys: Use if_stop wrapper function.

Exception: Not in kern_pmf.c, for the kind of silly reason that it
avoids having kern_pmf.c refer to symbols defined only in net; this
avoids a pain in the rump.

Revision 1.307 / (download) - annotate - [select for diffs], Fri Dec 10 01:18:29 2021 UTC (2 years, 4 months ago) by msaitoh
Branch: MAIN
Changes since 1.306: +3 -2 lines
Diff to previous 1.306 (colored) to selected 1.115 (colored)

Add comment to clarify.

Revision 1.306 / (download) - annotate - [select for diffs], Tue Nov 30 01:17:02 2021 UTC (2 years, 4 months ago) by yamaguchi
Branch: MAIN
Changes since 1.305: +3 -3 lines
Diff to previous 1.305 (colored) to selected 1.115 (colored)

Move net/agr/ieee8023_slowprotocols.h to net/ether_slowprotocols.h

Definitions related to slowprotocols are duplicated between
agr/ieee8023ad_slowprotocols.h and lagg/if_lagg_lacp.h
Therefore, the contents are moved to added file.

Note: currently, there are just LACP and Marker protocol,
however slowprotocols is independent of them.

Revision 1.305 / (download) - annotate - [select for diffs], Thu Nov 25 00:49:34 2021 UTC (2 years, 4 months ago) by msaitoh
Branch: MAIN
Changes since 1.304: +25 -17 lines
Diff to previous 1.304 (colored) to selected 1.115 (colored)

Better counting for ierrors, iqdrops and noproto in ether_input().

 - Use if_noproto for unknown or unsupported protocols.
 - Use if_ierrors for wrong mbuf or oversized frame.

Revision 1.304 / (download) - annotate - [select for diffs], Mon Nov 15 07:07:05 2021 UTC (2 years, 5 months ago) by yamaguchi
Branch: MAIN
Changes since 1.303: +100 -2 lines
Diff to previous 1.303 (colored) to selected 1.115 (colored)

introduced APIs to configure VLAN TAG to ethernet devices

Revision 1.303 / (download) - annotate - [select for diffs], Mon Nov 8 16:50:05 2021 UTC (2 years, 5 months ago) by christos
Branch: MAIN
Changes since 1.302: +14 -8 lines
Diff to previous 1.302 (colored) to selected 1.115 (colored)

Don't classify dropped packets that we don't understand as errors, for
example etype 0x88CA (TIPC (Transparent Inter Process Communication,)
or 0x893A (IEEE 1905).
Classify them as dropped like Linux does (FreeBSD just ignores them). From RVP.

Revision 1.302 / (download) - annotate - [select for diffs], Mon Oct 25 17:05:43 2021 UTC (2 years, 5 months ago) by ryo
Branch: MAIN
Changes since 1.301: +3 -3 lines
Diff to previous 1.301 (colored) to selected 1.115 (colored)

frame's vlan tag must be ntohs()'ed.
VLAN 0 Priority tag was misrecognized on non vlan-hwtagging interfaces.

Revision 1.301 / (download) - annotate - [select for diffs], Mon Oct 11 05:13:11 2021 UTC (2 years, 6 months ago) by knakahara
Branch: MAIN
Changes since 1.300: +14 -7 lines
Diff to previous 1.300 (colored) to selected 1.115 (colored)

Make pktq_rps_hash() pluggable for each interface type.  Reviewed by gdt@n.o, thorpej@n.o, and riastradh@n.o, thanks.

Revision 1.300 / (download) - annotate - [select for diffs], Thu Sep 30 04:29:16 2021 UTC (2 years, 6 months ago) by yamaguchi
Branch: MAIN
Changes since 1.299: +2 -8 lines
Diff to previous 1.299 (colored) to selected 1.115 (colored)

lagg: Register lagg_ifdetach to ether_ifdetach hook

Revision 1.299 / (download) - annotate - [select for diffs], Thu Sep 30 04:13:42 2021 UTC (2 years, 6 months ago) by yamaguchi
Branch: MAIN
Changes since 1.298: +2 -6 lines
Diff to previous 1.298 (colored) to selected 1.115 (colored)

vlan: Register vlan_ifdetach to ether_ifdetach hook

Revision 1.298 / (download) - annotate - [select for diffs], Thu Sep 30 03:57:48 2021 UTC (2 years, 6 months ago) by yamaguchi
Branch: MAIN
Changes since 1.297: +2 -6 lines
Diff to previous 1.297 (colored) to selected 1.115 (colored)

bridge: Register bridge_ifdetach to ether_ifdetach hook

Revision 1.297 / (download) - annotate - [select for diffs], Thu Sep 30 03:54:04 2021 UTC (2 years, 6 months ago) by yamaguchi
Branch: MAIN
Changes since 1.296: +41 -2 lines
Diff to previous 1.296 (colored) to selected 1.115 (colored)

Provide a hook point called when ether_ifdetach is called

Revision 1.296 / (download) - annotate - [select for diffs], Thu Sep 30 03:51:05 2021 UTC (2 years, 6 months ago) by yamaguchi
Branch: MAIN
Changes since 1.295: +2 -9 lines
Diff to previous 1.295 (colored) to selected 1.115 (colored)

net: obsolete ifnet::if_link_state_chenged
that was used for updating link-state of vlan I/F

The obsoleted function is replaced with
ifnet::if_linkstate_hooks

Revision 1.295 / (download) - annotate - [select for diffs], Thu Sep 30 03:47:27 2021 UTC (2 years, 6 months ago) by yamaguchi
Branch: MAIN
Changes since 1.294: +2 -7 lines
Diff to previous 1.294 (colored) to selected 1.115 (colored)

vlan: Register the callback to update link-state of vlan I/F
to link-state change hook

The callback is registered in every vlan I/F even if the parent
interface is the same. Therefore it is not needed to search the
vlan I/F by the parent interface unlike the previous callback.

Revision 1.294 / (download) - annotate - [select for diffs], Thu Sep 30 03:15:25 2021 UTC (2 years, 6 months ago) by yamaguchi
Branch: MAIN
Changes since 1.293: +13 -5 lines
Diff to previous 1.293 (colored) to selected 1.115 (colored)

Replace ifnet::if_agriprivate with ifnet::if_lagg

agr(4) and lagg(4) can not be used on the same interface so that
if_agrprivate and if_lagg are not used at the same time.
For resolve this wasteful, if_lagg is used in not only lagg(4)
but also agr(4).

After this modification, if_lagg has 3 states:
1. if_lagg == NULL
   - Both agr(4) and lagg(4) are not running on the interface
2. if_lagg != NULL && ifp->if_type != IFT_IEEE8023ADLAG
   - agr(4) is running on the I/F
3. if_lagg != NULL && ifp->if_type == IFT_IEEE8023ADLAG
   - lagg(4) is running on the I/F

Revision 1.293 / (download) - annotate - [select for diffs], Mon May 17 04:07:43 2021 UTC (2 years, 11 months ago) by yamaguchi
Branch: MAIN
CVS Tags: thorpej-i2c-spi-conf2-base, thorpej-i2c-spi-conf2, thorpej-i2c-spi-conf-base, thorpej-futex2-base, thorpej-futex2, thorpej-cfargs2-base, thorpej-cfargs2, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1
Changes since 1.292: +21 -2 lines
Diff to previous 1.292 (colored) to selected 1.115 (colored)

Add a new link-aggregation pseudo interface named lagg(4)

 - FreeBSD's lagg(4) based implementation
 - MP-safe and MP-scalable

Revision 1.292 / (download) - annotate - [select for diffs], Sun Feb 14 19:35:37 2021 UTC (3 years, 2 months ago) by roy
Branch: MAIN
CVS Tags: thorpej-futex-base, thorpej-cfargs-base, thorpej-cfargs, cjep_staticlib_x-base
Branch point for: thorpej-i2c-spi-conf, cjep_staticlib_x
Changes since 1.291: +6 -7 lines
Diff to previous 1.291 (colored) to selected 1.115 (colored)

if_ether: revert prior alignment checks

Apparently not needed as our drivers ensure this.

Revision 1.291 / (download) - annotate - [select for diffs], Sat Feb 13 13:00:16 2021 UTC (3 years, 2 months ago) by roy
Branch: MAIN
Changes since 1.290: +8 -12 lines
Diff to previous 1.290 (colored) to selected 1.115 (colored)

Prior alignment fixes should not use an offset

Revision 1.290 / (download) - annotate - [select for diffs], Sat Feb 13 07:28:04 2021 UTC (3 years, 2 months ago) by roy
Branch: MAIN
Changes since 1.289: +14 -5 lines
Diff to previous 1.289 (colored) to selected 1.115 (colored)

if_ether: Ensure that ether_header is aligned

Revision 1.289 / (download) - annotate - [select for diffs], Sat Sep 26 18:38:09 2020 UTC (3 years, 6 months ago) by roy
Branch: MAIN
Branch point for: thorpej-futex
Changes since 1.288: +14 -2 lines
Diff to previous 1.288 (colored) to selected 1.115 (colored)

vlan: match the interface link state with that of the parent

Now addresses on a vlan will detach and undergo duplicate address
dectection on link state changes just as on a standard interface.

Revision 1.288 / (download) - annotate - [select for diffs], Fri Aug 28 06:27:49 2020 UTC (3 years, 7 months ago) by ozaki-r
Branch: MAIN
Changes since 1.287: +3 -2 lines
Diff to previous 1.287 (colored) to selected 1.115 (colored)

ether: count dropped packets on output

Revision 1.287 / (download) - annotate - [select for diffs], Fri Aug 28 06:27:16 2020 UTC (3 years, 7 months ago) by ozaki-r
Branch: MAIN
Changes since 1.286: +30 -39 lines
Diff to previous 1.286 (colored) to selected 1.115 (colored)

ether: count dropped packets on input

Revision 1.286 / (download) - annotate - [select for diffs], Fri Aug 28 06:25:52 2020 UTC (3 years, 7 months ago) by ozaki-r
Branch: MAIN
Changes since 1.285: +111 -96 lines
Diff to previous 1.285 (colored) to selected 1.115 (colored)

ether: separate handling of LLC frames as ether_input_llc (NFCI)

Revision 1.285 / (download) - annotate - [select for diffs], Fri Aug 28 06:23:42 2020 UTC (3 years, 7 months ago) by ozaki-r
Branch: MAIN
Changes since 1.284: +3 -12 lines
Diff to previous 1.284 (colored) to selected 1.115 (colored)

net: introduce IFQ_ENQUEUE_ISR to assemble packet queuing routines (NFCI)

Revision 1.284 / (download) - annotate - [select for diffs], Thu Apr 30 03:29:55 2020 UTC (3 years, 11 months ago) by riastradh
Branch: MAIN
Changes since 1.283: +5 -4 lines
Diff to previous 1.283 (colored) to selected 1.115 (colored)

Convert ether_input from rnd_initial_entropy to entropy_epoch().

Revision 1.283 / (download) - annotate - [select for diffs], Sun Mar 15 23:14:41 2020 UTC (4 years, 1 month ago) by thorpej
Branch: MAIN
CVS Tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, is-mlppp-base, is-mlppp, bouyer-xenpvh-base2, bouyer-xenpvh-base1, bouyer-xenpvh-base, bouyer-xenpvh
Changes since 1.282: +4 -10 lines
Diff to previous 1.282 (colored) to selected 1.115 (colored)

Add and use a new function, mowner_init_owner(), that initializes an
MBUFTRACE mowner structure (so that providers of it don't have to
grovel the internals).

Revision 1.282 / (download) - annotate - [select for diffs], Wed Jan 29 04:11:35 2020 UTC (4 years, 2 months ago) by thorpej
Branch: MAIN
CVS Tags: ad-namecache-base3
Changes since 1.281: +6 -6 lines
Diff to previous 1.281 (colored) to selected 1.115 (colored)

Adopt <net/if_stats.h>.

Revision 1.281 / (download) - annotate - [select for diffs], Thu Jan 16 13:16:59 2020 UTC (4 years, 3 months ago) by kardel
Branch: MAIN
CVS Tags: ad-namecache-base2, ad-namecache-base1
Changes since 1.280: +4 -4 lines
Diff to previous 1.280 (colored) to selected 1.115 (colored)

use the CARP interface for arp/nd instead of the carp parent interface.
this provides the correct source mac address for the packets.

there are routers out there that cache the source mac during
nd and then subsequently bypass/miss packet filters on carp
interfaces as they send to the parent interface mac instead of the
correct carp interface mac.

Revision 1.280 / (download) - annotate - [select for diffs], Wed Oct 16 18:29:49 2019 UTC (4 years, 6 months ago) by christos
Branch: MAIN
CVS Tags: phil-wifi-20191119, ad-namecache-base
Branch point for: ad-namecache
Changes since 1.279: +4 -3 lines
Diff to previous 1.279 (colored) to selected 1.115 (colored)

Add and use __FPTRCAST, requested by uwe@

Revision 1.279 / (download) - annotate - [select for diffs], Wed Oct 16 15:27:39 2019 UTC (4 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.278: +3 -3 lines
Diff to previous 1.278 (colored) to selected 1.115 (colored)

Add void * function pointer casts. There are different ways to "fix" those
warnings:
    1. this one: add a void * cast (which I think is the least intrusive)
    2. add pragmas to elide the warning
    3. add intermediate inline conversion functions
    4. change the called function prototypes, adding unused arguments and
       converting some of the pointer arguments to void *.
    5. make the functions varyadic (which defeats the purpose of checking)
    6. pass command line flags to elide the warning
I did try 3 and 4 and I was not pleased with the result (sys_ptrace_common.c)
(3) added too much code and defines, and (4) made the regular use clumsy.

Revision 1.278 / (download) - annotate - [select for diffs], Wed Oct 2 04:17:16 2019 UTC (4 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.277: +8 -2 lines
Diff to previous 1.277 (colored) to selected 1.115 (colored)

 Print oversized frame's message only when DIAGNOSTIC is set. The message
is not so important because we increment if_iqdrops now.

Revision 1.277 / (download) - annotate - [select for diffs], Tue Oct 1 08:13:16 2019 UTC (4 years, 6 months ago) by msaitoh
Branch: MAIN
Changes since 1.276: +3 -2 lines
Diff to previous 1.276 (colored) to selected 1.115 (colored)

 Increment if_iqdrops when dropping an oversized frame.

Revision 1.276 / (download) - annotate - [select for diffs], Wed Jul 17 03:26:24 2019 UTC (4 years, 9 months ago) by msaitoh
Branch: MAIN
CVS Tags: netbsd-9-base
Branch point for: netbsd-9
Changes since 1.275: +11 -2 lines
Diff to previous 1.275 (colored) to selected 1.115 (colored)

 Implement VLAN hardware filter function(ETHERCAP_VLAN_HWFILTER).
First proposed by jmcneill in 2017 and modified by me.

How to use:

 - Set callback function:

	ether_set_vlan_cb(struct ethercom *, ether_vlancb_t)

 - Callback. This function is called when a vlan is attached/detached to the
   parent interface:

	int (*ether_vlancb_t)(struct ethercom *ec, uint16_t vlanid, bool set);

 - ifconfig(8)

	ifconfig ixg0 [-]vlan-hwfilter

 Note that ETHERCAP_VLAN_HWFILTER is set by default on ixg(4) because
the PF driver usually enable "all block" filter by default.

Revision 1.275 / (download) - annotate - [select for diffs], Wed May 29 10:07:30 2019 UTC (4 years, 10 months ago) by msaitoh
Branch: MAIN
CVS Tags: phil-wifi-20190609
Changes since 1.274: +9 -4 lines
Diff to previous 1.274 (colored) to selected 1.115 (colored)

Even if we don't use MII(4), use the common path of SIOC[GS]IFMEDIA in
sys/net/if_ethersubr.c if we can.
 - Add ec_ifmedia into struct ethercom.
 - ec_mii in struct ethercom is kept and used as it is. It might be used in
   future. Note that some Ethernet drivers which _DOESN'T_ use mii(4) use
   ec_mii for keeping the if_media. Those should be changed in future.

Revision 1.274 / (download) - annotate - [select for diffs], Wed May 15 02:56:48 2019 UTC (4 years, 11 months ago) by ozaki-r
Branch: MAIN
Changes since 1.273: +11 -2 lines
Diff to previous 1.273 (colored) to selected 1.115 (colored)

Store IFF_ALLMULTI in ec_flags instead of if_flags to avoid data races

IFF_ALLMULTI is set/unset to if_flags via if_mcast_op.  To avoid data races on
if_flags, IFNET_LOCK was added for if_mcast_op.  Unfortunately it produces
a deadlock so we want to remove added IFNET_LOCK by avoiding the data races by
another approach.

This fix introduces ec_flags to struct ethercom and stores IFF_ALLMULTI to it.
ec_flags is protected by ETHER_LOCK and thus IFNET_LOCK is no longer necessary
for if_mcast_op.  Note that the fix is applied only to MP-safe drivers that
the data races matter.

In the kernel, IFF_ALLMULTI is set by a driver and used by the driver itself.
So changing the storing place doesn't break anything.  One exception is
ioctl(SIOCGIFFLAGS); we have to include IFF_ALLMULTI in a result if needed to
export the flag as well as before.

A upcoming commit will remove IFNET_LOCK.

PR kern/54189

Revision 1.273 / (download) - annotate - [select for diffs], Mon Feb 4 10:11:34 2019 UTC (5 years, 2 months ago) by mrg
Branch: MAIN
CVS Tags: isaki-audio2-base, isaki-audio2
Changes since 1.272: +3 -4 lines
Diff to previous 1.272 (colored) to selected 1.115 (colored)

add or adjust fallthru comments.

Revision 1.272 / (download) - annotate - [select for diffs], Fri Dec 21 08:58:08 2018 UTC (5 years, 3 months ago) by msaitoh
Branch: MAIN
CVS Tags: pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226
Changes since 1.271: +59 -36 lines
Diff to previous 1.271 (colored) to selected 1.115 (colored)

 Add SIOCSETHERCAP. It's used to change ec_capenable.

Revision 1.271 / (download) - annotate - [select for diffs], Thu Nov 15 10:23:56 2018 UTC (5 years, 5 months ago) by maxv
Branch: MAIN
CVS Tags: pgoyette-compat-1126
Changes since 1.270: +3 -3 lines
Diff to previous 1.270 (colored) to selected 1.115 (colored)

Remove the 't' argument from m_tag_find().

Revision 1.270 / (download) - annotate - [select for diffs], Thu Jun 14 07:54:57 2018 UTC (5 years, 10 months ago) by yamaguchi
Branch: MAIN
CVS Tags: phil-wifi-base, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625
Branch point for: phil-wifi
Changes since 1.269: +4 -4 lines
Diff to previous 1.269 (colored) to selected 1.115 (colored)

Use ether_lookup_multi() instead of the macro

ok ozaki-r@

Revision 1.269 / (download) - annotate - [select for diffs], Tue Jun 12 07:12:35 2018 UTC (5 years, 10 months ago) by ozaki-r
Branch: MAIN
Changes since 1.268: +3 -2 lines
Diff to previous 1.268 (colored) to selected 1.115 (colored)

Check if ether_ifdetach is called without INET_LOCK

Revision 1.268 / (download) - annotate - [select for diffs], Tue May 29 16:24:34 2018 UTC (5 years, 10 months ago) by maxv
Branch: MAIN
Changes since 1.267: +2 -7 lines
Diff to previous 1.267 (colored) to selected 1.115 (colored)

Remove an XXX of mine, actually it's fine. While here also remove a
misleading printf.

Revision 1.267 / (download) - annotate - [select for diffs], Tue May 29 08:24:59 2018 UTC (5 years, 10 months ago) by maxv
Branch: MAIN
Changes since 1.266: +7 -3 lines
Diff to previous 1.266 (colored) to selected 1.115 (colored)

Replace KASSERT by m_pullup. While the ethernet header is always there
when the packet was received on a physical interface, it may not be if
the packet was received over L2TP/EtherIP.

In particular, if the inner ethernet header ends up on two separate IP
fragments. Here the KASSERT is triggered, and on !DIAGNOSTIC we corrupt
memory.

Note that this is a widespread problem: a lot of L2 code was written with
the assumption that "most" headers are present in the first mbuf.
Obviously, that's not true if L2 encapsulation is being used.

Revision 1.266 / (download) - annotate - [select for diffs], Wed May 9 06:35:10 2018 UTC (5 years, 11 months ago) by maxv
Branch: MAIN
CVS Tags: pgoyette-compat-0521
Changes since 1.265: +3 -3 lines
Diff to previous 1.265 (colored) to selected 1.115 (colored)

Replace
	m_copym(m, 0, M_COPYALL, M_DONTWAIT)
by
	m_copypacket(m, M_DONTWAIT)
when it is clear that we are copying a packet (that has M_PKTHDR) and not
a raw mbuf chain.

Revision 1.265 / (download) - annotate - [select for diffs], Sun Apr 29 07:13:10 2018 UTC (5 years, 11 months ago) by maxv
Branch: MAIN
CVS Tags: pgoyette-compat-0502
Changes since 1.264: +5 -5 lines
Diff to previous 1.264 (colored) to selected 1.115 (colored)

Remove references to m_copy in comments.

Revision 1.264 / (download) - annotate - [select for diffs], Thu Apr 26 19:56:55 2018 UTC (5 years, 11 months ago) by maxv
Branch: MAIN
Changes since 1.263: +3 -3 lines
Diff to previous 1.263 (colored) to selected 1.115 (colored)

m_copy -> m_copym

Revision 1.263 / (download) - annotate - [select for diffs], Mon Apr 9 16:14:11 2018 UTC (6 years ago) by maxv
Branch: MAIN
CVS Tags: pgoyette-compat-0422, pgoyette-compat-0415
Changes since 1.262: +6 -4 lines
Diff to previous 1.262 (colored) to selected 1.115 (colored)

Replace KASSERTMSG by a real check. L2 encapsulation protocols (at least
L2TP) don't ensure the LLC is there, and in !DIAGNOSTIC configurations
m_copydata will crash. Tested with L2TP.

Revision 1.262 / (download) - annotate - [select for diffs], Mon Apr 9 11:35:22 2018 UTC (6 years ago) by maxv
Branch: MAIN
Changes since 1.261: +3 -2 lines
Diff to previous 1.261 (colored) to selected 1.115 (colored)

Add KASSERT. The input point expects struct ether_header to be there.

Now, I'm wondering whether it can be triggered by L2 encapsulation
protocols - they may not provide a contiguous area.

Revision 1.261 / (download) - annotate - [select for diffs], Mon Apr 9 11:05:59 2018 UTC (6 years ago) by maxv
Branch: MAIN
Changes since 1.260: +33 -31 lines
Diff to previous 1.260 (colored) to selected 1.115 (colored)

Minor stylistic changes, add XXX and fix typo. No functional change.

Revision 1.260 / (download) - annotate - [select for diffs], Tue Feb 13 15:21:59 2018 UTC (6 years, 2 months ago) by maxv
Branch: MAIN
CVS Tags: pgoyette-compat-base, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315
Branch point for: pgoyette-compat
Changes since 1.259: +12 -11 lines
Diff to previous 1.259 (colored) to selected 1.115 (colored)

Make the arpresolve branch more readable, fix typo, fix XXX (which I
added), add missing pserialize_read_exit (which I forgot).

Revision 1.259 / (download) - annotate - [select for diffs], Tue Feb 13 10:50:38 2018 UTC (6 years, 2 months ago) by maxv
Branch: MAIN
Changes since 1.258: +2 -4 lines
Diff to previous 1.258 (colored) to selected 1.115 (colored)

Remove KERNEL_LOCK around the MPLS code. It's not needed, since we're only
touching the tag of the mbuf - the tag belongs only to the mbuf, and the
mbuf is not shared.

ok knakahara@

Revision 1.258 / (download) - annotate - [select for diffs], Mon Feb 12 12:17:38 2018 UTC (6 years, 2 months ago) by maxv
Branch: MAIN
Changes since 1.257: +5 -4 lines
Diff to previous 1.257 (colored) to selected 1.115 (colored)

Fix typo, and add a comment about MPLS.

Revision 1.257 / (download) - annotate - [select for diffs], Fri Jan 19 12:31:27 2018 UTC (6 years, 2 months ago) by nakayama
Branch: MAIN
Changes since 1.256: +3 -3 lines
Diff to previous 1.256 (colored) to selected 1.115 (colored)

Fix inverted logic.

Revision 1.256 / (download) - annotate - [select for diffs], Mon Jan 15 14:00:34 2018 UTC (6 years, 3 months ago) by maxv
Branch: MAIN
Changes since 1.255: +33 -20 lines
Diff to previous 1.255 (colored) to selected 1.115 (colored)

Style, and fix a bug in the AppleTalk path: we're doing
M_PREPEND(M_DONTWAIT), but we forgot to NULL-check the mbuf afterwards.

Revision 1.255 / (download) - annotate - [select for diffs], Mon Jan 15 13:14:18 2018 UTC (6 years, 3 months ago) by maxv
Branch: MAIN
Changes since 1.254: +16 -9 lines
Diff to previous 1.254 (colored) to selected 1.115 (colored)

Fix two bugs in altq_etherclassify. When scanning the mbuf chain we need
to make sure that m_next is not NULL, otherwise NULL deref. After that,
we must not touch m->m_pkthdr, given that 'm' may not be the first mbuf
of the chain anymore.

Declare mtop, and add a KASSERT to make sure it has M_PKTHDR set.

Revision 1.254 / (download) - annotate - [select for diffs], Mon Jan 15 12:17:05 2018 UTC (6 years, 3 months ago) by maxv
Branch: MAIN
Changes since 1.253: +6 -4 lines
Diff to previous 1.253 (colored) to selected 1.115 (colored)

Fix a bug in the VLAN path: there's an inverted logic, the mbuf needs to
be bigger than struct ether_vlan_header, not smaller.

Meanwhile add a KASSERT in the LLC path.

Revision 1.253 / (download) - annotate - [select for diffs], Mon Jan 15 11:57:27 2018 UTC (6 years, 3 months ago) by maxv
Branch: MAIN
Changes since 1.252: +33 -22 lines
Diff to previous 1.252 (colored) to selected 1.115 (colored)

Style, make the code more readable, and add a KASSERT (we expect the mbuf
to have M_PKTHDR set).

Revision 1.252 / (download) - annotate - [select for diffs], Mon Jan 15 10:27:51 2018 UTC (6 years, 3 months ago) by maxv
Branch: MAIN
Changes since 1.251: +21 -19 lines
Diff to previous 1.251 (colored) to selected 1.115 (colored)

Several fixes:
 - Style and typos
 - Use kmem_zalloc, in case there is a padding between the fields of
   the structures
 - Use ETHER_ADDR_LEN instead of a hard-coded '6'
 - kmem_alloc(KM_SLEEP) can't fail
 - Simplify ether_aton_r
 - Use mutex_obj_free, not to leak memory

Revision 1.251 / (download) - annotate - [select for diffs], Mon Jan 15 07:59:48 2018 UTC (6 years, 3 months ago) by maxv
Branch: MAIN
Changes since 1.250: +13 -6 lines
Diff to previous 1.250 (colored) to selected 1.115 (colored)

Fix the net.ether.multicast sysctl. If there is no multicast address
don't kmem_alloc(0) (which panics the kernel), and if the number of
multicast addresses has decreased don't copyout uninitialized kernel
data.

Revision 1.250 / (download) - annotate - [select for diffs], Sat Dec 9 10:51:30 2017 UTC (6 years, 4 months ago) by maxv
Branch: MAIN
Changes since 1.249: +24 -22 lines
Diff to previous 1.249 (colored) to selected 1.115 (colored)

style

Revision 1.249 / (download) - annotate - [select for diffs], Sat Dec 9 10:19:42 2017 UTC (6 years, 4 months ago) by maxv
Branch: MAIN
Changes since 1.248: +6 -3 lines
Diff to previous 1.248 (colored) to selected 1.115 (colored)

Make sure we have an llc structure in the packet, and don't read past the
end of the mbuf if we don't. I'm wondering whether we should not pull up
instead, but whatever.

Revision 1.248 / (download) - annotate - [select for diffs], Wed Dec 6 04:00:07 2017 UTC (6 years, 4 months ago) by ozaki-r
Branch: MAIN
Changes since 1.247: +6 -7 lines
Diff to previous 1.247 (colored) to selected 1.115 (colored)

Use kmem_alloc instead of kmem_intr_alloc in ether_addmulti

ether_addmulti is now not called in softint thanks to wqinput that
pulled input routines of ICMP out of softint.

Revision 1.247 / (download) - annotate - [select for diffs], Wed Nov 22 04:27:57 2017 UTC (6 years, 4 months ago) by msaitoh
Branch: MAIN
CVS Tags: tls-maxphys-base-20171202
Changes since 1.246: +23 -20 lines
Diff to previous 1.246 (colored) to selected 1.115 (colored)

- Modify ether_ioctl() for readability. No functional change.
- KNF

Revision 1.246 / (download) - annotate - [select for diffs], Thu Nov 16 03:07:18 2017 UTC (6 years, 5 months ago) by ozaki-r
Branch: MAIN
Changes since 1.245: +2 -10 lines
Diff to previous 1.245 (colored) to selected 1.115 (colored)

Unify IFEF_*_MPSAFE into IFEF_MPSAFE

There are already two flags for if_output and if_start, however, it seems such
MPSAFE flags are eventually needed for all if_XXX operations. Having discrete
flags for each operation is wasteful of if_extflags bits. So let's unify
the flags into one: IFEF_MPSAFE.

Fortunately IFEF_*_MPSAFE flags have never been included in any releases, so
we can change them without breaking backward compatibility of the releases
(though the kernel version of -current should be bumped).

Note that if an interface have both MP-safe and non-MP-safe operations at a
time, we have to set the IFEF_MPSAFE flag and let callees of non-MP-safe
opeartions take the kernel lock.

Proposed on tech-kern@ and tech-net@

Revision 1.245 / (download) - annotate - [select for diffs], Thu Oct 26 09:41:15 2017 UTC (6 years, 5 months ago) by msaitoh
Branch: MAIN
Changes since 1.244: +12 -12 lines
Diff to previous 1.244 (colored) to selected 1.115 (colored)

 Use macro(ETHER_LOCK() and ETHER_UNLOCK()). No functional change.

Revision 1.244 / (download) - annotate - [select for diffs], Tue Sep 26 07:42:06 2017 UTC (6 years, 6 months ago) by knakahara
Branch: MAIN
Changes since 1.243: +3 -3 lines
Diff to previous 1.243 (colored) to selected 1.115 (colored)

VLAN ID uses pkthdr instead of mtag now. Contributed by s-yamaguchi@IIJ.

I just commit by proxy. Reviewed by joerg@n.o and christos@n.o, thanks.
See http://mail-index.netbsd.org/tech-net/2017/09/26/msg006459.html

XXX need pullup to -8 branch

Revision 1.243 / (download) - annotate - [select for diffs], Sun Jul 23 10:55:00 2017 UTC (6 years, 8 months ago) by para
Branch: MAIN
CVS Tags: nick-nhusb-base-20170825
Changes since 1.242: +5 -5 lines
Diff to previous 1.242 (colored) to selected 1.115 (colored)

kmem_intr_free kmem_intr_[z]alloced memory

the underlying pools are the same but api-wise those should match

Revision 1.242 / (download) - annotate - [select for diffs], Thu Apr 6 03:54:59 2017 UTC (7 years ago) by ozaki-r
Branch: MAIN
CVS Tags: prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, pgoyette-localcount-20170426, perseant-stdc-iso10646-base, perseant-stdc-iso10646, netbsd-8-base, jdolecek-ncq-base, jdolecek-ncq, bouyer-socketcan-base1
Branch point for: netbsd-8
Changes since 1.241: +2 -4 lines
Diff to previous 1.241 (colored) to selected 1.115 (colored)

Revert "Make sure to hold if_ioctl_lock when calling ifp->if_ioctl"

As per pgoyette@ and riastradh@ requests; we shouldn't decide to
hold a lock based on if the lock is held or not.

Revision 1.241 / (download) - annotate - [select for diffs], Wed Apr 5 03:47:51 2017 UTC (7 years ago) by ozaki-r
Branch: MAIN
Changes since 1.240: +4 -2 lines
Diff to previous 1.240 (colored) to selected 1.115 (colored)

Make sure to hold if_ioctl_lock when calling ifp->if_ioctl

Unfortunately callers of ifp->if_ioctl (if_addr_init, if_flags_set
and if_mcast_op) may or may not hold if_ioctl_lock, so we have to
hold the lock only if it's not held.

Revision 1.240 / (download) - annotate - [select for diffs], Fri Mar 24 09:22:46 2017 UTC (7 years ago) by ozaki-r
Branch: MAIN
Changes since 1.239: +2 -11 lines
Diff to previous 1.239 (colored) to selected 1.115 (colored)

Remove KERNEL_LOCK for arpresolve in ether_output

Because arpresolve should be already MP-safe.

Revision 1.239 / (download) - annotate - [select for diffs], Tue Feb 21 03:59:31 2017 UTC (7 years, 1 month ago) by ozaki-r
Branch: MAIN
CVS Tags: pgoyette-localcount-20170320
Changes since 1.238: +3 -5 lines
Diff to previous 1.238 (colored) to selected 1.115 (colored)

Sweep unnecessary malloc.h inclusions

Revision 1.238 / (download) - annotate - [select for diffs], Tue Feb 14 03:05:06 2017 UTC (7 years, 2 months ago) by ozaki-r
Branch: MAIN
Changes since 1.237: +12 -5 lines
Diff to previous 1.237 (colored) to selected 1.115 (colored)

Do ND in L2_output in the same manner as arpresolve

The benefits of this change are:
- The flow is consistent with IPv4 (and FreeBSD and OpenBSD)
  - old: ip6_output => nd6_output (do ND if needed) => L2_output (lookup a stored cache)
  - new: ip6_output => L2_output (lookup a cache. Do ND if cache not found)
- We can remove some workarounds in nd6_output
- We can move L2 specific operations to their own place
- The performance slightly improves because one cache lookup is reduced

Revision 1.237 / (download) - annotate - [select for diffs], Sun Feb 12 09:36:05 2017 UTC (7 years, 2 months ago) by skrll
Branch: MAIN
Changes since 1.236: +5 -16 lines
Diff to previous 1.236 (colored) to selected 1.115 (colored)

Remove redundant splnet/splx calls - ec_lock is IPL_NET.

Revision 1.236 / (download) - annotate - [select for diffs], Tue Jan 24 18:37:20 2017 UTC (7 years, 2 months ago) by maxv
Branch: MAIN
CVS Tags: nick-nhusb-base-20170204
Changes since 1.235: +3 -2 lines
Diff to previous 1.235 (colored) to selected 1.115 (colored)

Don't forget to free the mbuf when we decide not to reply to an ARP
request. This obviously is a terrible bug, since it allows a remote sender
to DoS the system with specially-crafted requests sent in a loop.

Revision 1.235 / (download) - annotate - [select for diffs], Fri Jan 13 06:11:56 2017 UTC (7 years, 3 months ago) by msaitoh
Branch: MAIN
CVS Tags: bouyer-socketcan-base
Branch point for: bouyer-socketcan
Changes since 1.234: +2 -6 lines
Diff to previous 1.234 (colored) to selected 1.115 (colored)

 Fix a bug that the parent interface's callback wasn't called when the vlan
interface is configured. A callback function uses VLAN_ATTACHED() function
which check ec->ec_nvlans, the value should be incremented before calling the
callback. This bug was added in if_vlan.c rev. 1.83 (2015/11/19).

Revision 1.234 / (download) - annotate - [select for diffs], Tue Jan 10 05:42:34 2017 UTC (7 years, 3 months ago) by ozaki-r
Branch: MAIN
Changes since 1.233: +6 -3 lines
Diff to previous 1.233 (colored) to selected 1.115 (colored)

Enable some sysctl knobs on rump kernels for ifmcstat

Revision 1.233 / (download) - annotate - [select for diffs], Tue Jan 10 05:40:59 2017 UTC (7 years, 3 months ago) by ozaki-r
Branch: MAIN
Changes since 1.232: +44 -17 lines
Diff to previous 1.232 (colored) to selected 1.115 (colored)

Replace adaptive mutex for ethercom with spin one

Unfortunately even wm(4) doesn't allow adaptive mutex because wm(4)
tries to hold it with holding its own spin mutex.

Revision 1.232 / (download) - annotate - [select for diffs], Sat Dec 31 15:07:02 2016 UTC (7 years, 3 months ago) by ozaki-r
Branch: MAIN
CVS Tags: pgoyette-localcount-20170107
Changes since 1.231: +4 -3 lines
Diff to previous 1.231 (colored) to selected 1.115 (colored)

Use kmem_intr_alloc instead of kmem_alloc

ether_addmulti still can be called in softint.

Fix PR kern/51755

Revision 1.231 / (download) - annotate - [select for diffs], Wed Dec 28 07:32:16 2016 UTC (7 years, 3 months ago) by ozaki-r
Branch: MAIN
Changes since 1.230: +57 -35 lines
Diff to previous 1.230 (colored) to selected 1.115 (colored)

Protect ec_multi* with mutex

The data can be accessed from sysctl, ioctl, interface watchdog
(if_slowtimo) and interrupt handlers. We need to protect the data against
parallel accesses from them.

Currently the mutex is applied to some drivers, we need to apply it to all
drivers in the future.

Note that the mutex is adaptive one for ease of implementation but some
drivers access the data in interrupt context so we cannot apply the mutex
to every drivers as is. We have two options: one is to replace the mutex
with a spin one, which requires some additional works (see
ether_multicast_sysctl), and the other is to modify the drivers to access
the data not in interrupt context somehow.

Revision 1.230 / (download) - annotate - [select for diffs], Wed Dec 28 07:26:24 2016 UTC (7 years, 3 months ago) by ozaki-r
Branch: MAIN
Changes since 1.229: +4 -3 lines
Diff to previous 1.229 (colored) to selected 1.115 (colored)

Use ether_ifattach in carp_clone_create instead of C&P code

carp_clone_destroy calls ether_ifdetach so not calling ether_ifattach is
inconsistent. If we add something pair of initialization and destruction
to ether_ifattach and ether_ifdetach (e.g., mutex_init/mutex_destroy),
ether_ifdetach of carp_clone_destroy won't work. So use ether_ifattach.

In order to do so, make ether_ifattach accept the 2nd argument (lla) as
NULL to allow carp to initialize its link level address by itself.

Revision 1.229 / (download) - annotate - [select for diffs], Tue Oct 18 07:30:30 2016 UTC (7 years, 5 months ago) by ozaki-r
Branch: MAIN
CVS Tags: pgoyette-localcount-20161104, nick-nhusb-base-20161204
Changes since 1.228: +12 -2 lines
Diff to previous 1.228 (colored) to selected 1.115 (colored)

Don't hold global locks if NET_MPSAFE is enabled

If NET_MPSAFE is enabled, don't hold KERNEL_LOCK and softnet_lock in
part of the network stack such as IP forwarding paths. The aim of the
change is to make it easy to test the network stack without the locks
and reduce our local diffs.

By default (i.e., if NET_MPSAFE isn't enabled), the locks are held
as they used to be.

Reviewed by knakahara@

Revision 1.228 / (download) - annotate - [select for diffs], Mon Oct 3 11:06:06 2016 UTC (7 years, 6 months ago) by ozaki-r
Branch: MAIN
CVS Tags: nick-nhusb-base-20161004
Changes since 1.227: +6 -2 lines
Diff to previous 1.227 (colored) to selected 1.115 (colored)

Fix race condition on ifqueue used by traditional netisr

If a underlying network device driver supports MSI/MSI-X, RX interrupts
can be delivered to arbitrary CPUs. This means that Layer 2 subroutines
such as ether_input (softint) and subsequent Layer 3 subroutines (softint)
which are called via traditional netisr can be dispatched on an arbitrary
CPU. Layer 2 subroutines now run without any locks (expected) and so a
Layer 2 subroutine and a Layer 3 subroutine can run in parallel.

There is a shared data between a Layer 2 routine and a Layer 3 routine,
that is ifqueue and IF_ENQUEUE (from L2) and IF_DEQUEUE (from L3) on it
are racy now.

To fix the race condition, use ifqueue#ifq_lock to protect ifqueue
instead of splnet that is meaningless now.

The same race condition exists in route_intr. Fix it as well.

Reviewed by knakahara@

Revision 1.227 / (download) - annotate - [select for diffs], Mon Aug 1 03:15:30 2016 UTC (7 years, 8 months ago) by ozaki-r
Branch: MAIN
CVS Tags: pgoyette-localcount-20160806, localcount-20160914
Changes since 1.226: +23 -11 lines
Diff to previous 1.226 (colored) to selected 1.115 (colored)

Apply pserialize and psref to struct ifaddr and its variants

This change makes struct ifaddr and its variants (in_ifaddr and in6_ifaddr)
MP-safe by using pserialize and psref. At this moment, pserialize_perform
and psref_target_destroy are disabled because (1) we don't need them
because of softnet_lock (2) they cause a deadlock because of softnet_lock.
So we'll enable them when we remove softnet_lock in the future.

Revision 1.226 / (download) - annotate - [select for diffs], Mon Jul 25 23:46:09 2016 UTC (7 years, 8 months ago) by rjs
Branch: MAIN
CVS Tags: pgoyette-localcount-20160726
Changes since 1.225: +3 -3 lines
Diff to previous 1.225 (colored) to selected 1.115 (colored)

Restore correct test for return value from aarpresolve().

Revision 1.225 / (download) - annotate - [select for diffs], Tue Jun 21 03:54:04 2016 UTC (7 years, 9 months ago) by knakahara
Branch: MAIN
CVS Tags: pgoyette-localcount-base, nick-nhusb-base-20160907
Branch point for: pgoyette-localcount
Changes since 1.224: +8 -3 lines
Diff to previous 1.224 (colored) to selected 1.115 (colored)

fix ATF net/carp failure

Revision 1.224 / (download) - annotate - [select for diffs], Mon Jun 20 07:01:45 2016 UTC (7 years, 9 months ago) by knakahara
Branch: MAIN
Changes since 1.223: +19 -7 lines
Diff to previous 1.223 (colored) to selected 1.115 (colored)

make ether_output() MP-safe, so that if_ether can enable IFEF_OUTPUT_MPSAFE.

making MP-scalable is future work.

Revision 1.223 / (download) - annotate - [select for diffs], Thu Jun 16 03:03:33 2016 UTC (7 years, 10 months ago) by ozaki-r
Branch: MAIN
Changes since 1.222: +18 -8 lines
Diff to previous 1.222 (colored) to selected 1.115 (colored)

Use if_get_byindex instead of if_byindex for MP-safe

Revision 1.222 / (download) - annotate - [select for diffs], Thu Apr 28 00:16:56 2016 UTC (7 years, 11 months ago) by ozaki-r
Branch: MAIN
CVS Tags: nick-nhusb-base-20160529
Changes since 1.221: +4 -4 lines
Diff to previous 1.221 (colored) to selected 1.115 (colored)

Constify rtentry of if_output

We no longer need to change rtentry below if_output.

The change makes it clear where rtentries are changed (or not)
and helps forthcoming locking (os psrefing) rtentries.

Revision 1.221 / (download) - annotate - [select for diffs], Wed Apr 20 09:01:04 2016 UTC (7 years, 11 months ago) by knakahara
Branch: MAIN
CVS Tags: nick-nhusb-base-20160422
Changes since 1.220: +3 -4 lines
Diff to previous 1.220 (colored) to selected 1.115 (colored)

IFQ_ENQUEUE refactor (3/3) : eliminate pktattr argument from IFQ_ENQUEUE caller

Revision 1.220 / (download) - annotate - [select for diffs], Wed Apr 20 08:58:48 2016 UTC (7 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.219: +4 -5 lines
Diff to previous 1.219 (colored) to selected 1.115 (colored)

IFQ_ENQUEUE refactor (2/3) : eliminate pktattr argument from altq implemantation

Revision 1.219 / (download) - annotate - [select for diffs], Wed Apr 20 08:56:32 2016 UTC (7 years, 11 months ago) by knakahara
Branch: MAIN
Changes since 1.218: +9 -9 lines
Diff to previous 1.218 (colored) to selected 1.115 (colored)

IFQ_ENQUEUE refactor (1/3) : add altq_pktattr fields to m_pkthdr

Reviewed by joerg@n.o and tls@n.o, thanks.

Revision 1.218 / (download) - annotate - [select for diffs], Fri Apr 15 01:31:29 2016 UTC (8 years ago) by ozaki-r
Branch: MAIN
Changes since 1.217: +5 -24 lines
Diff to previous 1.217 (colored) to selected 1.115 (colored)

Hide PPPoE variables from if_ethersubr.c

This improves modularity of if_pppoe.

From s-yamaguchi@IIJ

Revision 1.217 / (download) - annotate - [select for diffs], Thu Apr 7 03:22:15 2016 UTC (8 years ago) by christos
Branch: MAIN
Changes since 1.216: +4 -3 lines
Diff to previous 1.216 (colored) to selected 1.115 (colored)

- tidy up error messages
- add a length argument to arpresolve()
- add KASSERT for overflow

Revision 1.216 / (download) - annotate - [select for diffs], Tue Feb 9 08:32:12 2016 UTC (8 years, 2 months ago) by ozaki-r
Branch: MAIN
CVS Tags: nick-nhusb-base-20160319
Changes since 1.215: +6 -3 lines
Diff to previous 1.215 (colored) to selected 1.115 (colored)

Introduce softint-based if_input

This change intends to run the whole network stack in softint context
(or normal LWP), not hardware interrupt context. Note that the work is
still incomplete by this change; to that end, we also have to softint-ify
if_link_state_change (and bpf) which can still run in hardware interrupt.

This change softint-ifies at ifp->if_input that is called from
each device driver (and ieee80211_input) to ensure Layer 2 runs
in softint (e.g., ether_input and bridge_input). To this end,
we provide a framework (called percpuq) that utlizes softint(9)
and percpu ifqueues. With this patch, rxintr of most drivers just
queues received packets and schedules a softint, and the softint
dequeues packets and does rest packet processing.

To minimize changes to each driver, percpuq is allocated in struct
ifnet for now and that is initialized by default (in if_attach).
We probably have to move percpuq to softc of each driver, but it's
future work. At this point, only wm(4) has percpuq in its softc
as a reference implementation.

Additional information including performance numbers can be found
in the thread at tech-kern@ and tech-net@:
http://mail-index.netbsd.org/tech-kern/2016/01/14/msg019997.html

Acknowledgment: riastradh@ greatly helped this work.
Thank you very much!

Revision 1.215 / (download) - annotate - [select for diffs], Thu Nov 19 16:23:54 2015 UTC (8 years, 4 months ago) by christos
Branch: MAIN
CVS Tags: nick-nhusb-base-20151226
Changes since 1.214: +71 -2 lines
Diff to previous 1.214 (colored) to selected 1.115 (colored)


Add handling of VLAN packets in if_bridge where the parent interface supports
them (Jean-Jacques.Puig@espci.fr). Factor out the vlan_mtu enabling and
disabling code.

Revision 1.214 / (download) - annotate - [select for diffs], Tue Oct 13 12:33:07 2015 UTC (8 years, 6 months ago) by roy
Branch: MAIN
Changes since 1.213: +5 -5 lines
Diff to previous 1.213 (colored) to selected 1.115 (colored)

arpresolve() now returns 0 on success otherwise an error code.
Callers of arpresolve() now pass the error code back to their caller,
masking out EWOULDBLOCK.

This allows applications such as ping(8) to display a suitable error
condition.

Revision 1.213 / (download) - annotate - [select for diffs], Mon Aug 31 08:05:20 2015 UTC (8 years, 7 months ago) by ozaki-r
Branch: MAIN
CVS Tags: nick-nhusb-base-20150921
Changes since 1.212: +3 -3 lines
Diff to previous 1.212 (colored) to selected 1.115 (colored)

Replace ARP cache (llinfo) with lltable/llentry

Highlights of the change are:
- Use llentry instead of llinfo to manage ARP caches
  - ARP specific data are stored in the hashed list
    of an interface instead of the global list (llinfo_arp)
- Fine-grain locking on llentry
- arptimer (callout) per ARP cache
  - the global timer callout with the big locks can be
    removed (though softnet_lock is still required for now)
- net.inet.arp.prune is now obsoleted
  - it was the interval of the global timer callout
- net.inet.arp.refresh is now obsoleted
  - it was a parameter that prevents expiration of active caches
  - Removed to simplify the timer logic, but we may be able to
    restore the feature if really needed

Proposed on tech-kern and tech-net.

Revision 1.212 / (download) - annotate - [select for diffs], Mon Aug 24 22:21:26 2015 UTC (8 years, 7 months ago) by pooka
Branch: MAIN
Changes since 1.211: +5 -2 lines
Diff to previous 1.211 (colored) to selected 1.115 (colored)

sprinkle _KERNEL_OPT

Revision 1.211 / (download) - annotate - [select for diffs], Wed Aug 12 02:20:31 2015 UTC (8 years, 8 months ago) by ozaki-r
Branch: MAIN
Changes since 1.210: +4 -12 lines
Diff to previous 1.210 (colored) to selected 1.115 (colored)

Tidy up header inclusions

Revision 1.210 / (download) - annotate - [select for diffs], Thu Jun 4 09:19:59 2015 UTC (8 years, 10 months ago) by ozaki-r
Branch: MAIN
CVS Tags: nick-nhusb-base-20150606
Changes since 1.209: +11 -43 lines
Diff to previous 1.209 (colored) to selected 1.115 (colored)

Pull out route lookups from L2 output routines

Route lookups for routes of RTF_GATEWAY were done in L2 output
routines such as ether_output, but they should be done in L3
i.e., before L2 output routines. This change places the lookups
between L3 output routines (say ip_output) and the L2 output
routines.

The change is based on dyoung's patch submitted in the thread:
https://mail-index.netbsd.org/tech-net/2013/02/01/msg003847.html
You can find out detailed investigations by dyoung about the
issue in there.

Note that the change introduces a workaround for MPLS. ether_output
knew that it needs to fill the ethertype of a frame as MPLS,
based on a tag of an original route (rtentry), but now we don't
pass it to ehter_output. So we have to tell that in another way.
We use mtag to do so for now, which introduces some overhead.
We should fix it somehow in the future.

Discussed on tech-kern and tech-net.

Revision 1.209 / (download) - annotate - [select for diffs], Mon May 25 08:29:01 2015 UTC (8 years, 10 months ago) by ozaki-r
Branch: MAIN
Changes since 1.208: +2 -25 lines
Diff to previous 1.208 (colored) to selected 1.115 (colored)

Remove leftover IPX-related stuffs

No objection on tech-kern and tech-net.

Revision 1.208 / (download) - annotate - [select for diffs], Wed May 20 09:17:18 2015 UTC (8 years, 10 months ago) by ozaki-r
Branch: MAIN
Changes since 1.207: +3 -3 lines
Diff to previous 1.207 (colored) to selected 1.115 (colored)

Remove leftover use of AF_NS and NS option

Unnecessary NETISR_NS is also removed.

Revision 1.207 / (download) - annotate - [select for diffs], Mon Apr 13 22:46:57 2015 UTC (9 years ago) by riastradh
Branch: MAIN
Changes since 1.206: +3 -2 lines
Diff to previous 1.206 (colored) to selected 1.115 (colored)

Include <sys/rndsource.h> for rnd_add_data.

Revision 1.206 / (download) - annotate - [select for diffs], Fri Apr 3 07:55:18 2015 UTC (9 years ago) by ozaki-r
Branch: MAIN
CVS Tags: nick-nhusb-base-20150406
Changes since 1.205: +5 -2 lines
Diff to previous 1.205 (colored) to selected 1.115 (colored)

Don't grab KERNEL_LOCK during if_output when NET_MPSAFE

The change makes L3 MP-safe work easy. At this point
we deal with only IP forwarding.

No functional change when NET_MPSAFE isn't enabled.

Revision 1.205 / (download) - annotate - [select for diffs], Fri Nov 28 08:29:00 2014 UTC (9 years, 4 months ago) by ozaki-r
Branch: MAIN
CVS Tags: nick-nhusb-base
Branch point for: nick-nhusb
Changes since 1.204: +2 -6 lines
Diff to previous 1.204 (colored) to selected 1.115 (colored)

Remove dead codes and make if_free_sadl static

No functional change.

Revision 1.204 / (download) - annotate - [select for diffs], Sun Aug 10 16:44:36 2014 UTC (9 years, 8 months ago) by tls
Branch: MAIN
CVS Tags: tls-maxphys-base, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-base, netbsd-7-1-RC1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE
Branch point for: netbsd-7-nhusb, netbsd-7-0, netbsd-7
Changes since 1.203: +9 -2 lines
Diff to previous 1.203 (colored) to selected 1.115 (colored)

Merge tls-earlyentropy branch into HEAD.

Revision 1.203 / (download) - annotate - [select for diffs], Mon Jul 28 14:24:48 2014 UTC (9 years, 8 months ago) by ozaki-r
Branch: MAIN
CVS Tags: tls-earlyentropy-base
Changes since 1.202: +11 -2 lines
Diff to previous 1.202 (colored) to selected 1.115 (colored)

Add a mutex for global variables of if_ethersubr.c

To initialize the mutex, we introduce etherinit that is called from ifinit1.

Revision 1.202 / (download) - annotate - [select for diffs], Mon Jun 30 10:03:41 2014 UTC (9 years, 9 months ago) by ozaki-r
Branch: MAIN
Changes since 1.201: +5 -4 lines
Diff to previous 1.201 (colored) to selected 1.115 (colored)

Schedule pppoe_softintr only when a packet is enqueued

Revision 1.201 / (download) - annotate - [select for diffs], Tue Jun 17 10:39:46 2014 UTC (9 years, 10 months ago) by ozaki-r
Branch: MAIN
Changes since 1.200: +16 -42 lines
Diff to previous 1.200 (colored) to selected 1.115 (colored)

Restructure ether_input and bridge_input

The network stack of NetBSD is well organized and
layered. A packet reception is processed from a
lower layer to an upper layer one by one. However,
ether_input and bridge_input are not structured so.
bridge_input is called inside ether_input.

The new structure replaces ifnet#if_input of a bridge
member with bridge_input when the member is attached.
So a packet goes straight on a packet reception via
a bridge, bridge_input => ether_input => ip_input.

The change is part of a patch of Lloyd Parkes submitted
in PR 48104. Unlike the patch, the change doesn't
intend to change the behavior of the packet processing.
Another patch will fix PR 48104.

Revision 1.200 / (download) - annotate - [select for diffs], Tue Jun 10 09:38:30 2014 UTC (9 years, 10 months ago) by joerg
Branch: MAIN
Changes since 1.199: +70 -2 lines
Diff to previous 1.199 (colored) to selected 1.115 (colored)

Introduce new sysctls for obtaining interface-specific addresses:
- net.sdl for the active link-layer adddress (the MAC)
- net.ether.multicast for the Ethernet multicast addresses
- net.inet6.multicast for the IPv6 multicast groups
- net.inet6.multicast_kludge for temporarily removed multicast groups

Use this sysctls for replacing the kmem grovelling in ifmcstat(8).

Revision 1.199 / (download) - annotate - [select for diffs], Thu Jun 5 23:48:16 2014 UTC (9 years, 10 months ago) by rmind
Branch: MAIN
Changes since 1.198: +19 -7 lines
Diff to previous 1.198 (colored) to selected 1.115 (colored)

- Implement pktqueue interface for lockless IP input queue.
- Replace ipintrq and ip6intrq with the pktqueue mechanism.
- Eliminate kernel-lock from ipintr() and ip6intr().
- Some preparation work to push softnet_lock out of ipintr().

Discussed on tech-net.

Revision 1.198 / (download) - annotate - [select for diffs], Thu May 15 07:35:38 2014 UTC (9 years, 11 months ago) by msaitoh
Branch: MAIN
CVS Tags: rmind-smpnet-nbase, rmind-smpnet-base
Changes since 1.197: +13 -10 lines
Diff to previous 1.197 (colored) to selected 1.115 (colored)

 Usually schednetisr() is called after enqueueing a packet with IF_ENQUEUE().
In some functions, they do it in reverse order. It's not a bug because
the pair is protected with splnet()/splx(s). It's not good for readability
and someone might mistake when modifing a code. Yes, I'm one of the person :-(

 Save a NETISR_* value in a variable and call schednetisr() after enqueue
a packet for readability and future modification.

Revision 1.197 / (download) - annotate - [select for diffs], Tue May 13 19:36:16 2014 UTC (9 years, 11 months ago) by bouyer
Branch: MAIN
Changes since 1.196: +4 -2 lines
Diff to previous 1.196 (colored) to selected 1.115 (colored)

Make sure *(if_output)() is called with KERNEL_LOCK held.
Add some KASSERT for this.
See http://mail-index.netbsd.org/tech-net/2014/04/09/msg004511.html
for details.

Revision 1.196 / (download) - annotate - [select for diffs], Tue Feb 25 22:42:06 2014 UTC (10 years, 1 month ago) by pooka
Branch: MAIN
CVS Tags: yamt-pagecache-base9, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3
Branch point for: tls-earlyentropy
Changes since 1.195: +6 -2 lines
Diff to previous 1.195 (colored) to selected 1.115 (colored)

If the in6 domain was not attached, do not attempt to process IPv6 packets.

Revision 1.195 / (download) - annotate - [select for diffs], Sat Jun 29 21:06:58 2013 UTC (10 years, 9 months ago) by rmind
Branch: MAIN
CVS Tags: riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2
Changes since 1.194: +4 -9 lines
Diff to previous 1.194 (colored) to selected 1.115 (colored)

- Rewrite parts of pfil(9): use array to store hooks and thus be more cache
  friendly (there are only few hooks in the system).  Make the structures
  opaque and the interface more strict.
- Remove PFIL_HOOKS option by making pfil(9) mandatory.

Revision 1.194 / (download) - annotate - [select for diffs], Fri Mar 1 18:25:56 2013 UTC (11 years, 1 month ago) by joerg
Branch: MAIN
CVS Tags: khorben-n900, agc-symver-base, agc-symver
Branch point for: rmind-smpnet
Changes since 1.193: +4 -131 lines
Diff to previous 1.193 (colored) to selected 1.115 (colored)

Retire OSI network stack. OK core@

Revision 1.193 / (download) - annotate - [select for diffs], Wed Oct 31 10:17:34 2012 UTC (11 years, 5 months ago) by msaitoh
Branch: MAIN
CVS Tags: yamt-pagecache-base8, yamt-pagecache-base7
Changes since 1.192: +8 -2 lines
Diff to previous 1.192 (colored) to selected 1.115 (colored)

Add SIOCGETHERCAP ioctl.
There was no way to know the setting of ec_capabilities and ec_capenable
other than grepping the source.

See http://mail-index.netbsd.org/tech-kern/2010/07/28/msg008613.html

Revision 1.192 / (download) - annotate - [select for diffs], Thu Oct 11 20:05:50 2012 UTC (11 years, 6 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base6
Changes since 1.191: +3 -3 lines
Diff to previous 1.191 (colored) to selected 1.115 (colored)

PR/47058: Antti Kantee: If the ipv6 flow code modifies the mbuf, pass the
change up to the caller.

Revision 1.191 / (download) - annotate - [select for diffs], Fri Oct 5 04:26:06 2012 UTC (11 years, 6 months ago) by matt
Branch: MAIN
Changes since 1.190: +10 -10 lines
Diff to previous 1.190 (colored) to selected 1.115 (colored)

When setting a link address, don't bring up the interface automatically.

Revision 1.190 / (download) - annotate - [select for diffs], Tue Jul 17 18:08:20 2012 UTC (11 years, 9 months ago) by christos
Branch: MAIN
Branch point for: tls-maxphys
Changes since 1.189: +11 -2 lines
Diff to previous 1.189 (colored) to selected 1.115 (colored)

PR/46587: Roger Pau Monne: Prevent panic on shutdown on bridge teardown ->
ifpromisc-> if_ioctl -> if_init. Idea from dyoung.
XXX: Pullup to 6.

Revision 1.189 / (download) - annotate - [select for diffs], Fri May 11 04:05:54 2012 UTC (11 years, 11 months ago) by chs
Branch: MAIN
CVS Tags: yamt-pagecache-base5, jmcneill-usbmp-base10
Changes since 1.188: +3 -2 lines
Diff to previous 1.188 (colored) to selected 1.115 (colored)

in ether_ifdetach(), clear if_mowner before releasing what it points to.
fixes PR 42982.

Revision 1.188 / (download) - annotate - [select for diffs], Thu Jun 16 19:47:30 2011 UTC (12 years, 10 months ago) by kefren
Branch: MAIN
CVS Tags: yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, netbsd-6-base, jmcneill-usbmp-pre-base2, jmcneill-usbmp-base9, jmcneill-usbmp-base8, jmcneill-usbmp-base7, jmcneill-usbmp-base6, jmcneill-usbmp-base5, jmcneill-usbmp-base4, jmcneill-usbmp-base3, jmcneill-usbmp-base2, jmcneill-usbmp-base, jmcneill-audiomp3-base, jmcneill-audiomp3
Branch point for: yamt-pagecache, netbsd-6, jmcneill-usbmp
Changes since 1.187: +4 -3 lines
Diff to previous 1.187 (colored) to selected 1.115 (colored)

use ETHERTYPE_MPLS only for unicast packets (RFC3032)

Revision 1.187 / (download) - annotate - [select for diffs], Tue May 24 17:16:43 2011 UTC (12 years, 10 months ago) by matt
Branch: MAIN
CVS Tags: rmind-uvmplock-nbase, rmind-uvmplock-base, cherry-xenmp-base
Branch point for: cherry-xenmp
Changes since 1.186: +24 -7 lines
Diff to previous 1.186 (colored) to selected 1.115 (colored)

Add code to auto-deencapsulate 0 tagged VLANs.

Revision 1.186 / (download) - annotate - [select for diffs], Mon Apr 25 22:14:45 2011 UTC (12 years, 11 months ago) by yamt
Branch: MAIN
Changes since 1.185: +3 -3 lines
Diff to previous 1.185 (colored) to selected 1.115 (colored)

use ETHER_IS_MULTICAST macro.  no functional changes.

Revision 1.185 / (download) - annotate - [select for diffs], Wed Jan 12 15:30:40 2011 UTC (13 years, 3 months ago) by tsutsui
Branch: MAIN
CVS Tags: jruoho-x86intr-base, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2
Branch point for: jruoho-x86intr
Changes since 1.184: +3 -3 lines
Diff to previous 1.184 (colored) to selected 1.115 (colored)

Fix off by one in ether_aton_r().  Noticed by "arp info overwritten" warning.
(how could it be missed for months?)

Revision 1.184 / (download) - annotate - [select for diffs], Wed Nov 17 00:20:49 2010 UTC (13 years, 5 months ago) by dyoung
Branch: MAIN
CVS Tags: matt-mips64-premerge-20101231
Changes since 1.183: +9 -9 lines
Diff to previous 1.183 (colored) to selected 1.115 (colored)

Cosmetic: fix indentation.

Revision 1.183 / (download) - annotate - [select for diffs], Sun Jun 27 13:39:11 2010 UTC (13 years, 9 months ago) by kefren
Branch: MAIN
CVS Tags: yamt-nfs-mp-base11, yamt-nfs-mp-base10, uebayasi-xip-base4, uebayasi-xip-base3, uebayasi-xip-base2
Changes since 1.182: +4 -3 lines
Diff to previous 1.182 (colored) to selected 1.115 (colored)

Don't assume that rt_tag family is AF_MPLS but verify it.
This way rt_tag can be used for other future work also, not only MPLS

Revision 1.182 / (download) - annotate - [select for diffs], Sat Jun 26 14:24:28 2010 UTC (13 years, 9 months ago) by kefren
Branch: MAIN
Changes since 1.181: +24 -4 lines
Diff to previous 1.181 (colored) to selected 1.115 (colored)

Add MPLS support, proposed on tech-net@ a couple of days ago

Welcome to 5.99.33

Revision 1.181 / (download) - annotate - [select for diffs], Wed May 19 20:43:51 2010 UTC (13 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.180: +3 -4 lines
Diff to previous 1.180 (colored) to selected 1.115 (colored)

delint previous

Revision 1.180 / (download) - annotate - [select for diffs], Wed May 19 20:41:59 2010 UTC (13 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.179: +34 -41 lines
Diff to previous 1.179 (colored) to selected 1.115 (colored)

Replace ether_nonstatic_aton with a
- better named one
- not suffering from buffer oveflow
- simpler
- handling different separators
- returning error codes for errors

Some ideas from one posted on tech-net by Jonathan A. Kollasch

Revision 1.179 / (download) - annotate - [select for diffs], Wed May 19 18:58:22 2010 UTC (13 years, 11 months ago) by jakllsch
Branch: MAIN
Changes since 1.178: +41 -32 lines
Diff to previous 1.178 (colored) to selected 1.115 (colored)

Changes to ether_nonstatic_aton():

Be more leinent on input string format.  Each nibble pair may optionally be
followed by any of ':', '-', '.' or ' '.

Make source string const and work on a temporary copy.  The caller may not
expect their string to be destroyed.

Revision 1.178 / (download) - annotate - [select for diffs], Wed May 5 18:12:24 2010 UTC (13 years, 11 months ago) by dyoung
Branch: MAIN
Changes since 1.177: +4 -3 lines
Diff to previous 1.177 (colored) to selected 1.115 (colored)

Constify some ether_output() arguments so that it's clear that they
can never be re-assigned.

Revision 1.177 / (download) - annotate - [select for diffs], Mon Apr 5 07:22:23 2010 UTC (14 years ago) by joerg
Branch: MAIN
CVS Tags: uebayasi-xip-base1
Changes since 1.176: +4 -5 lines
Diff to previous 1.176 (colored) to selected 1.115 (colored)

Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf
check into the inline functions as well the fourth argument for
bpf_attach.

Revision 1.176 / (download) - annotate - [select for diffs], Tue Jan 19 22:08:00 2010 UTC (14 years, 2 months ago) by pooka
Branch: MAIN
CVS Tags: yamt-nfs-mp-base9, uebayasi-xip-base
Branch point for: uebayasi-xip, rmind-uvmplock
Changes since 1.175: +5 -11 lines
Diff to previous 1.175 (colored) to selected 1.115 (colored)

Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client.  This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached.  However, callers of bpf can
now be modularized.

Dynamically loadable bpf could probably be done fairly easily with
coordination from the stub driver and the real driver by registering
attachments in the stub before the real driver is loaded and doing
a handoff.  ... and I'm not going to ponder the depths of unload
here.

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.

Revision 1.175 / (download) - annotate - [select for diffs], Sat Nov 28 09:20:37 2009 UTC (14 years, 4 months ago) by mbalmer
Branch: MAIN
CVS Tags: matt-premerge-20091211
Changes since 1.174: +3 -3 lines
Diff to previous 1.174 (colored) to selected 1.115 (colored)

Fix function name that was changed by mistake in the previous whitespace
commit.

Revision 1.174 / (download) - annotate - [select for diffs], Sat Nov 28 02:58:21 2009 UTC (14 years, 4 months ago) by isaki
Branch: MAIN
Changes since 1.173: +11 -11 lines
Diff to previous 1.173 (colored) to selected 1.115 (colored)

white space -> tab.

Revision 1.173 / (download) - annotate - [select for diffs], Fri Nov 20 02:14:56 2009 UTC (14 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.172: +6 -3 lines
Diff to previous 1.172 (colored) to selected 1.115 (colored)

ar_tha() can return NULL; treat this as an error.

Revision 1.172 / (download) - annotate - [select for diffs], Fri May 29 04:57:04 2009 UTC (14 years, 10 months ago) by darran
Branch: MAIN
CVS Tags: yamt-nfs-mp-base8, yamt-nfs-mp-base7, yamt-nfs-mp-base6, yamt-nfs-mp-base5, jymxensuspend-base, jym-xensuspend-nbase
Changes since 1.171: +11 -11 lines
Diff to previous 1.171 (colored) to selected 1.115 (colored)

Add vlan support and hardware offload capabilities to agr.
These changes allow vlans to be layered above agr, with the attach
and detach propogated to the member ports in the aggregation.
Note the agr interface must be up before the vlan is attached.

Adds SIOCINITIFADDR support to the wm driver for setting the AF_LINK
address, necessary for agr to be able to set the mac addresses of each
port to the agr address (i.e. so it can receive all intended traffic
at the hardware level).

Adds support for disabling the LACP protocol by setting LINK1 on the agr
interface (e.g. ifconfig agr0 link1).

In consultation with tls@.

Revision 1.171 / (download) - annotate - [select for diffs], Tue Apr 28 21:26:51 2009 UTC (14 years, 11 months ago) by dyoung
Branch: MAIN
CVS Tags: yamt-nfs-mp-base4, yamt-nfs-mp-base3, nick-hppapmap-base4, jym-xensuspend-base
Changes since 1.170: +8 -5 lines
Diff to previous 1.170 (colored) to selected 1.115 (colored)

Let this build with 'no options INET'.

(I don't know why I bothered, either.)

Revision 1.170 / (download) - annotate - [select for diffs], Fri Nov 7 00:20:13 2008 UTC (15 years, 5 months ago) by dyoung
Branch: MAIN
CVS Tags: nick-hppapmap-base3, nick-hppapmap-base2, nick-hppapmap-base, mjf-devfs2-base, haad-nbase2, haad-dm-base2, haad-dm-base, ad-audiomp2-base, ad-audiomp2
Branch point for: jym-xensuspend
Changes since 1.169: +43 -29 lines
Diff to previous 1.169 (colored) to selected 1.115 (colored)

*** Summary ***

When a link-layer address changes (e.g., ifconfig ex0 link
02:de:ad:be:ef:02 active), send a gratuitous ARP and/or a Neighbor
Advertisement to update the network-/link-layer address bindings
on our LAN peers.

Refuse a change of ethernet address to the address 00:00:00:00:00:00
or to any multicast/broadcast address.  (Thanks matt@.)

Reorder ifnet ioctl operations so that driver ioctls may inherit
the functions of their "class"---ether_ioctl(), fddi_ioctl(), et
cetera---and the class ioctls may inherit from the generic ioctl,
ifioctl_common(), but both driver- and class-ioctls may override
the generic behavior.  Make network drivers share more code.

Distinguish a "factory" link-layer address from others for the
purposes of both protecting that address from deletion and computing
EUI64.

Return consistent, appropriate error codes from network drivers.

Improve readability.  KNF.

*** Details ***

In if_attach(), always initialize the interface ioctl routine,
ifnet->if_ioctl, if the driver has not already initialized it.
Delete if_ioctl == NULL tests everywhere else, because it cannot
happen.

In the ioctl routines of network interfaces, inherit common ioctl
behaviors by calling either ifioctl_common() or whichever ioctl
routine is appropriate for the class of interface---e.g., ether_ioctl()
for ethernets.

Stop (ab)using SIOCSIFADDR and start to use SIOCINITIFADDR.  In
the user->kernel interface, SIOCSIFADDR's argument was an ifreq,
but on the protocol->ifnet interface, SIOCSIFADDR's argument was
an ifaddr.  That was confusing, and it would work against me as I
make it possible for a network interface to overload most ioctls.
On the protocol->ifnet interface, replace SIOCSIFADDR with
SIOCINITIFADDR.  In ifioctl(), return EPERM if userland tries to
invoke SIOCINITIFADDR.

In ifioctl(), give the interface the first shot at handling most
interface ioctls, and give the protocol the second shot, instead
of the other way around. Finally, let compatibility code (COMPAT_OSOCK)
take a shot.

Pull device initialization out of switch statements under
SIOCINITIFADDR.  For example, pull ..._init() out of any switch
statement that looks like this:

        switch (...->sa_family) {
        case ...:
                ..._init();
                ...
                break;
        ...
        default:
                ..._init();
                ...
                break;
        }

Rewrite many if-else clauses that handle all permutations of IFF_UP
and IFF_RUNNING to use a switch statement,

        switch (x & (IFF_UP|IFF_RUNNING)) {
        case 0:
                ...
                break;
        case IFF_RUNNING:
                ...
                break;
        case IFF_UP:
                ...
                break;
        case IFF_UP|IFF_RUNNING:
                ...
                break;
        }

unifdef lots of code containing #ifdef FreeBSD, #ifdef NetBSD, and
#ifdef SIOCSIFMTU, especially in fwip(4) and in ndis(4).

In ipw(4), remove an if_set_sadl() call that is out of place.

In nfe(4), reuse the jumbo MTU logic in ether_ioctl().

Let ethernets register a callback for setting h/w state such as
promiscuous mode and the multicast filter in accord with a change
in the if_flags: ether_set_ifflags_cb() registers a callback that
returns ENETRESET if the caller should reset the ethernet by calling
if_init(), 0 on success, != 0 on failure.  Pull common code from
ex(4), gem(4), nfe(4), sip(4), tlp(4), vge(4) into ether_ioctl(),
and register if_flags callbacks for those drivers.

Return ENOTTY instead of EINVAL for inappropriate ioctls.  In
zyd(4), use ENXIO instead of ENOTTY to indicate that the device is
not any longer attached.

Add to if_set_sadl() a boolean 'factory' argument that indicates
whether a link-layer address was assigned by the factory or some
other source.  In a comment, recommend using the factory address
for generating an EUI64, and update in6_get_hw_ifid() to prefer a
factory address to any other link-layer address.

Add a routing message, RTM_LLINFO_UPD, that tells protocols to
update the binding of network-layer addresses to link-layer addresses.
Implement this message in IPv4 and IPv6 by sending a gratuitous
ARP or a neighbor advertisement, respectively.  Generate RTM_LLINFO_UPD
messages on a change of an interface's link-layer address.

In ether_ioctl(), do not let SIOCALIFADDR set a link-layer address
that is broadcast/multicast or equal to 00:00:00:00:00:00.

Make ether_ioctl() call ifioctl_common() to handle ioctls that it
does not understand.

In gif(4), initialize if_softc and use it, instead of assuming that
the gif_softc and ifp overlap.

Let ifioctl_common() handle SIOCGIFADDR.

Sprinkle rtcache_invariants(), which checks on DIAGNOSTIC kernels
that certain invariants on a struct route are satisfied.

In agr(4), rewrite agr_ioctl_filter() to be a bit more explicit
about the ioctls that we do not allow on an agr(4) member interface.

bzero -> memset.  Delete unnecessary casts to void *.  Use
sockaddr_in_init() and sockaddr_in6_init().  Compare pointers with
NULL instead of "testing truth".  Replace some instances of (type
*)0 with NULL.  Change some K&R prototypes to ANSI C, and join
lines.

Revision 1.169 / (download) - annotate - [select for diffs], Wed Jul 23 06:34:31 2008 UTC (15 years, 8 months ago) by dyoung
Branch: MAIN
CVS Tags: wrstuden-revivesa-base-4, wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, simonb-wapbl-nbase, simonb-wapbl-base, netbsd-5-base, netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, netbsd-5-0-1-RELEASE, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20091211, matt-nb4-mips64-k7-u2a-k9b, matt-mips64-base2, haad-dm-base1
Branch point for: nick-hppapmap, netbsd-5-0, netbsd-5, matt-nb5-mips64
Changes since 1.168: +28 -34 lines
Diff to previous 1.168 (colored) to selected 1.115 (colored)

Fix this another way: add the missing case statement.

Revision 1.168 / (download) - annotate - [select for diffs], Wed Jul 23 05:41:47 2008 UTC (15 years, 8 months ago) by gmcgarry
Branch: MAIN
Changes since 1.167: +36 -29 lines
Diff to previous 1.167 (colored) to selected 1.115 (colored)

Back out rev 1.163 which broke the logic for SIOCSIFFLAGS.  PR#38976.

Revision 1.167 / (download) - annotate - [select for diffs], Tue May 13 17:58:52 2008 UTC (15 years, 11 months ago) by dyoung
Branch: MAIN
CVS Tags: yamt-pf42-base4, yamt-pf42-base3, yamt-pf42-base2, yamt-nfs-mp-base2, wrstuden-revivesa-base-1, wrstuden-revivesa-base, hpcarm-cleanup-nbase
Branch point for: simonb-wapbl, haad-dm
Changes since 1.166: +2 -15 lines
Diff to previous 1.166 (colored) to selected 1.115 (colored)

Delete unreachable SIOCSIFADDR/AF_LINK case.

Revision 1.166 / (download) - annotate - [select for diffs], Sun May 11 20:13:30 2008 UTC (15 years, 11 months ago) by dyoung
Branch: MAIN
Changes since 1.165: +8 -8 lines
Diff to previous 1.165 (colored) to selected 1.115 (colored)

Where applicable, s/0/NULL/, s/Bcmp/memcmp/.  Remove a gratuitous
cast from a call to nd6_storelladdr().

Revision 1.165 / (download) - annotate - [select for diffs], Fri May 9 06:08:19 2008 UTC (15 years, 11 months ago) by rumble
Branch: MAIN
Changes since 1.164: +2 -3 lines
Diff to previous 1.164 (colored) to selected 1.115 (colored)

Nix a tautological return introduced in 1.129.

Revision 1.164 / (download) - annotate - [select for diffs], Sat Mar 15 05:07:34 2008 UTC (16 years, 1 month ago) by matt
Branch: MAIN
CVS Tags: yamt-pf42-baseX, yamt-pf42-base, yamt-nfs-mp-base, yamt-lazymbuf-base15, yamt-lazymbuf-base14, matt-armv6-nbase, keiichi-mipv6-nbase, keiichi-mipv6-base, ad-socklock-base1
Branch point for: yamt-pf42, yamt-nfs-mp, wrstuden-revivesa
Changes since 1.163: +4 -4 lines
Diff to previous 1.163 (colored) to selected 1.115 (colored)

Make sure M_PROMISC isn't already set, before we need to see if we are going
to see if we need to set M_PROMISC.
Assume the interface is not CARP'ed.

Revision 1.163 / (download) - annotate - [select for diffs], Wed Mar 12 18:22:24 2008 UTC (16 years, 1 month ago) by dyoung
Branch: MAIN
Changes since 1.162: +32 -42 lines
Diff to previous 1.162 (colored) to selected 1.115 (colored)

Make some cosmetic changes:

        Use fewer 'error = ...; break;' statements and more 'return
        ...;'

        Make the SIOCSIFFLAGS case more clear by using a switch
        statement instead of an if-else if-else chain.

        Shorten a staircase, and remove two unnecessary curly
        braces.

Revision 1.162 / (download) - annotate - [select for diffs], Wed Feb 20 17:05:53 2008 UTC (16 years, 1 month ago) by matt
Branch: MAIN
CVS Tags: nick-net80211-sync-base, nick-net80211-sync, hpcarm-cleanup-base
Branch point for: mjf-devfs2, keiichi-mipv6
Changes since 1.161: +20 -20 lines
Diff to previous 1.161 (colored) to selected 1.115 (colored)

s/u_\(int[0-9]*_t\)/u\1/g
(change u_int*_t to uint*_t)

Revision 1.161 / (download) - annotate - [select for diffs], Thu Feb 7 01:22:00 2008 UTC (16 years, 2 months ago) by dyoung
Branch: MAIN
CVS Tags: mjf-devfs-base
Changes since 1.160: +8 -5 lines
Diff to previous 1.160 (colored) to selected 1.115 (colored)

Start patching up the kernel so that a network driver always has
the opportunity to handle an ioctl before generic ifioctl handling
occurs.  This will ease extending the kernel and sharing of code
between drivers.

First steps:  Make the signature of ifioctl_common() match struct
ifinet->if_ioctl.  Convert SIOCSIFCAP and SIOCSIFMTU to the new
ifioctl() regime, throughout the kernel.

Revision 1.160 / (download) - annotate - [select for diffs], Sat Jan 19 20:11:52 2008 UTC (16 years, 3 months ago) by dyoung
Branch: MAIN
CVS Tags: bouyer-xeni386-nbase, bouyer-xeni386-base
Changes since 1.159: +10 -3 lines
Diff to previous 1.159 (colored) to selected 1.115 (colored)

Add default handling of SIOCSIFMEDIA/SIOCGIFMEDIA.

Revision 1.159 / (download) - annotate - [select for diffs], Wed Jan 2 00:41:07 2008 UTC (16 years, 3 months ago) by dyoung
Branch: MAIN
CVS Tags: matt-armv6-base
Changes since 1.158: +2 -32 lines
Diff to previous 1.158 (colored) to selected 1.115 (colored)

Fix XEN2_DOMU (and amd64?) builds: move ether_mediastatus(),
ether_mediachange() to their own module that we compile only if
the kernel configuration demands support for both MII buses and
ethernet.  Thanks to Tom Spindler for suggesting that these routines
move to dev/mii/.

Revision 1.158 / (download) - annotate - [select for diffs], Mon Dec 31 22:48:41 2007 UTC (16 years, 3 months ago) by dyoung
Branch: MAIN
Changes since 1.157: +37 -2 lines
Diff to previous 1.157 (colored) to selected 1.115 (colored)

Add media-handling code for several ethernet drivers with MII buses
to share.

Revision 1.157 / (download) - annotate - [select for diffs], Thu Dec 20 21:08:21 2007 UTC (16 years, 4 months ago) by dyoung
Branch: MAIN
CVS Tags: vmlocking2-base3
Changes since 1.156: +4 -9 lines
Diff to previous 1.156 (colored) to selected 1.115 (colored)

Constify struct ifnet->if_sadl and every use throughout the tree.
Add if_set_sadl() that both sets the link-layer address length and
replaces the current link-layer address with a new one, and use it
throughout the tree.

Revision 1.156 / (download) - annotate - [select for diffs], Mon Oct 8 16:18:04 2007 UTC (16 years, 6 months ago) by ad
Branch: MAIN
CVS Tags: yamt-x86pmap-base4, yamt-x86pmap-base3, yamt-kmem-base3, yamt-kmem-base2, yamt-kmem-base, yamt-kmem, vmlocking2-base2, vmlocking2-base1, vmlocking-nbase, vmlocking-base, reinoud-bufcleanup-nbase, reinoud-bufcleanup-base, jmcneill-pm-base, jmcneill-base, cube-autoconf-base, cube-autoconf, bouyer-xenamd64-base2, bouyer-xenamd64-base, bouyer-xenamd64
Branch point for: vmlocking2, mjf-devfs, bouyer-xeni386
Changes since 1.155: +5 -5 lines
Diff to previous 1.155 (colored) to selected 1.115 (colored)

Use the softint API.

Revision 1.155 / (download) - annotate - [select for diffs], Wed Sep 19 05:25:33 2007 UTC (16 years, 7 months ago) by dyoung
Branch: MAIN
CVS Tags: yamt-x86pmap-base2, yamt-x86pmap-base
Branch point for: yamt-x86pmap
Changes since 1.154: +13 -15 lines
Diff to previous 1.154 (colored) to selected 1.115 (colored)

Constify sockaddr argument to ether_multiaddr().  Change struct
ifreq * arguments to ether_addmulti() and ether_delmulti() to const
struct sockaddr *, since ether_{add,del}multi() only ever read the
sockaddr ifreq member, ifr_addr.  Update uses in carp(4) and in
vlan(4).

Revision 1.154 / (download) - annotate - [select for diffs], Thu Aug 30 02:17:35 2007 UTC (16 years, 7 months ago) by dyoung
Branch: MAIN
CVS Tags: nick-csl-alignment-base5
Changes since 1.153: +7 -5 lines
Diff to previous 1.153 (colored) to selected 1.115 (colored)

Use malloc(9) for sockaddrs instead of pool(9), and remove dom_sa_pool
and dom_sa_len members from struct domain.  Pools of fixed-size
objects are too rigid for sockaddr_dls, whose size can vary over
a wide range.

Return sockaddr_dl to its "historical" size.  Now that I'm using
malloc(9) instead of pool(9) to allocate sockaddr_dl, I can create
a sockaddr_dl of any size in the kernel, so expanding sockaddr_dl
is useless.

Avoid using sizeof(struct sockaddr_dl) in the kernel.

Introduce sockaddr_dl_alloc() for allocating & initializing an
arbitrary sockaddr_dl on the heap.

Add an argument, the sockaddr length, to sockaddr_alloc(),
sockaddr_copy(), and sockaddr_dl_setaddr().

Constify: LLADDR() -> CLLADDR().

Where the kernel overwrites LLADDR(), use sockaddr_dl_setaddr(),
instead.  Used properly, sockaddr_dl_setaddr() will not overrun
the end of the sockaddr.

Revision 1.153 / (download) - annotate - [select for diffs], Sun Aug 26 23:07:16 2007 UTC (16 years, 7 months ago) by dyoung
Branch: MAIN
Branch point for: matt-armv6
Changes since 1.152: +8 -8 lines
Diff to previous 1.152 (colored) to selected 1.115 (colored)

Constify: LLADDR -> CLLADDR.  I'm aiming here to make it easier to
identify sockaddr_dl abuse that remains in the kernel, especially
the potential for overwriting memory past the end of a sockaddr_dl
with, e.g., memcpy(LLADDR(), ...).

Use sockaddr_dl_setaddr() in a few places.

Revision 1.152 / (download) - annotate - [select for diffs], Tue Aug 7 04:37:44 2007 UTC (16 years, 8 months ago) by dyoung
Branch: MAIN
CVS Tags: matt-mips64-base
Branch point for: matt-mips64
Changes since 1.151: +7 -8 lines
Diff to previous 1.151 (colored) to selected 1.115 (colored)

Constify.

Revision 1.151 / (download) - annotate - [select for diffs], Sat Jul 21 02:24:11 2007 UTC (16 years, 9 months ago) by dyoung
Branch: MAIN
CVS Tags: hpcarm-cleanup
Branch point for: jmcneill-pm
Changes since 1.150: +3 -3 lines
Diff to previous 1.150 (colored) to selected 1.115 (colored)

Use NULL instead of 0 for null pointers.

Revision 1.150 / (download) - annotate - [select for diffs], Sat Jul 14 21:02:39 2007 UTC (16 years, 9 months ago) by ad
Branch: MAIN
CVS Tags: nick-csl-alignment-base
Branch point for: nick-csl-alignment
Changes since 1.149: +2 -7 lines
Diff to previous 1.149 (colored) to selected 1.115 (colored)

Generic soft interrupts are mandatory.

Revision 1.149 / (download) - annotate - [select for diffs], Tue May 29 21:32:29 2007 UTC (16 years, 10 months ago) by christos
Branch: MAIN
CVS Tags: mjf-ufs-trans-base
Changes since 1.148: +6 -4 lines
Diff to previous 1.148 (colored) to selected 1.115 (colored)

Add a sockaddr_storage member to "struct ifreq" maintaining backwards
compatibility with the older ioctls. This avoids stack smashing and
abuse of "struct sockaddr" when ioctls placed "struct sockaddr_foo's" that
were longer than "struct sockaddr".
XXX: Some of the emulations might be broken; I tried to add code for
them but I did not test them.

Revision 1.148 / (download) - annotate - [select for diffs], Wed Mar 7 22:20:05 2007 UTC (17 years, 1 month ago) by liamjfoy
Branch: MAIN
CVS Tags: yamt-idlelwp-base8, thorpej-atomic-base, thorpej-atomic, reinoud-bufcleanup
Branch point for: vmlocking, mjf-ufs-trans
Changes since 1.147: +6 -2 lines
Diff to previous 1.147 (colored) to selected 1.115 (colored)

Add IPv6 Fast Forward - the IPv4 counterpart:

If ip6_forward successfully forwards a packet, a cache, in this case a
ip6flow struct entry, will be created. ether_input and friends will
then be able to call ip6flow_fastforward with the packet which will then
be passed to if_output (unless an issue is found - in that case the packet
is passed back to ip6_input).

ok matt@ christos@ dyoung@ and joerg@

Revision 1.147 / (download) - annotate - [select for diffs], Sun Mar 4 06:03:15 2007 UTC (17 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.146: +7 -7 lines
Diff to previous 1.146 (colored) to selected 1.115 (colored)

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.

Revision 1.146 / (download) - annotate - [select for diffs], Tue Feb 20 08:55:54 2007 UTC (17 years, 1 month ago) by dyoung
Branch: MAIN
CVS Tags: ad-audiomp-base, ad-audiomp
Changes since 1.145: +42 -39 lines
Diff to previous 1.145 (colored) to selected 1.115 (colored)

Remove extraneous parentheses.  bcopy -> memcpy.

Revision 1.145 / (download) - annotate - [select for diffs], Sat Feb 17 22:34:08 2007 UTC (17 years, 2 months ago) by dyoung
Branch: MAIN
Changes since 1.144: +23 -28 lines
Diff to previous 1.144 (colored) to selected 1.115 (colored)

KNF: de-__P, bzero -> memset, bcmp -> memcmp.  Remove extraneous
   parentheses in return statements.

Cosmetic: don't open-code TAILQ_FOREACH().

Cosmetic: change types of variables to avoid oodles of casts: in
   in6_src.c, avoid casts by changing several route_in6 pointers
   to struct route pointers.  Remove unnecessary casts to caddr_t
   elsewhere.

Pave the way for eliminating address family-specific route caches:
   soon, struct route will not embed a sockaddr, but it will hold
   a reference to an external sockaddr, instead.  We will set the
   destination sockaddr using rtcache_setdst().  (I created a stub
   for it, but it isn't used anywhere, yet.)  rtcache_free() will
   free the sockaddr.  I have extracted from rtcache_free() a helper
   subroutine, rtcache_clear().  rtcache_clear() will "forget" a
   cached route, but it will not forget the destination by releasing
   the sockaddr.  I use rtcache_clear() instead of rtcache_free()
   in rtcache_update(), because rtcache_update() is not supposed
   to forget the destination.

Constify:

   1 Introduce const accessor for route->ro_dst, rtcache_getdst().

   2 Constify the 'dst' argument to ifnet->if_output().  This
     led me to constify a lot of code called by output routines.

   3 Constify the sockaddr argument to protosw->pr_ctlinput.  This
     led me to constify a lot of code called by ctlinput routines.

   4 Introduce const macros for converting from a generic sockaddr
     to family-specific sockaddrs, e.g., sockaddr_in: satocsin6,
     satocsin, et cetera.

Revision 1.144 / (download) - annotate - [select for diffs], Mon Jan 29 22:13:14 2007 UTC (17 years, 2 months ago) by bouyer
Branch: MAIN
CVS Tags: post-newlock2-merge, newlock2-nbase, newlock2-base
Branch point for: yamt-idlelwp
Changes since 1.143: +11 -6 lines
Diff to previous 1.143 (colored) to selected 1.115 (colored)

Drop M_PROMISC before passing the packet to a carp device, for the same
reason it's dropped before passing to bridge: when a vlan interface is
in promisc mode, it will loop the packet back to ether_input() with
M_PROMISC set, and when carp calls ether_input again the flag is still
there and the packet is dropped. If the carp interface doesn't take
the packet M_PROMISC is set just after is needed anyway.
Tested on a box with multiple carp on vlans, no comments about this patch
on tech-net@

Revision 1.143 / (download) - annotate - [select for diffs], Sat Jan 27 07:12:16 2007 UTC (17 years, 2 months ago) by cbiere
Branch: MAIN
Changes since 1.142: +3 -16 lines
Diff to previous 1.142 (colored) to selected 1.115 (colored)

Use a plain memcpy() instead of alignment- and endian-specific hacks.

Revision 1.142 / (download) - annotate - [select for diffs], Sat Jan 6 20:38:14 2007 UTC (17 years, 3 months ago) by bouyer
Branch: MAIN
Changes since 1.141: +4 -2 lines
Diff to previous 1.141 (colored) to selected 1.115 (colored)

Don't define dropanyway: label unless ISO or NETATALK is defined. Fix
kern/35364 by Gene ENonymous

Revision 1.141 / (download) - annotate - [select for diffs], Sun Dec 10 11:39:43 2006 UTC (17 years, 4 months ago) by is
Branch: MAIN
CVS Tags: yamt-splraiseipl-base5, yamt-splraiseipl-base4
Changes since 1.140: +5 -5 lines
Diff to previous 1.140 (colored) to selected 1.115 (colored)

explain XID constants, and fix a wrong one

Revision 1.140 / (download) - annotate - [select for diffs], Sun Dec 10 10:51:11 2006 UTC (17 years, 4 months ago) by is
Branch: MAIN
Changes since 1.139: +3 -3 lines
Diff to previous 1.139 (colored) to selected 1.115 (colored)

comment on llc class

Revision 1.139 / (download) - annotate - [select for diffs], Fri Dec 1 18:43:40 2006 UTC (17 years, 4 months ago) by is
Branch: MAIN
CVS Tags: yamt-splraiseipl-base3, netbsd-4-base
Branch point for: netbsd-4
Changes since 1.138: +57 -54 lines
Diff to previous 1.138 (colored) to selected 1.115 (colored)

Remove an overlapping struct copy from ether_input, which caused address
corruption for incoming netiso packets with recent (at least NetBSD-3 and
later) compilers. This is done in a way that the copy is avoided totally.
Code path tested with tcp+udp/ipv4+ipv6, arp and ISO cltp/clnp.
Visually ok'd by Christos@.

Revision 1.138 / (download) - annotate - [select for diffs], Fri Nov 24 01:04:30 2006 UTC (17 years, 4 months ago) by rpaulo
Branch: MAIN
Changes since 1.137: +41 -2 lines
Diff to previous 1.137 (colored) to selected 1.115 (colored)

The change I committed to etherip was wrong. ether_snprintf doesn't make
sense when chaning the MAC address of the virtual interface as pointed
out by Hans himself.
So, introduce ether_nonstatic_aton() and make etherip(4) and tap(4) use it.

Revision 1.137 / (download) - annotate - [select for diffs], Thu Nov 23 04:07:07 2006 UTC (17 years, 4 months ago) by rpaulo
Branch: MAIN
Changes since 1.136: +13 -17 lines
Diff to previous 1.136 (colored) to selected 1.115 (colored)

New EtherIP driver based on tap(4) and gif(4) by Hans Rosenfeld.
Notable changes:
	* Fixes PR 34268.
	* Separates the code from gif(4) (which is more cleaner).
	* Allows the usage of STP (Spanning Tree Protocol).
	* Removed EtherIP implementation from gif(4)/tap(4).

Some input from Christos.

Revision 1.136 / (download) - annotate - [select for diffs], Thu Sep 7 02:40:33 2006 UTC (17 years, 7 months ago) by dogcow
Branch: MAIN
CVS Tags: yamt-splraiseipl-base2, yamt-splraiseipl-base, yamt-pdpolicy-base9, rpaulo-netinet-merge-pcb-base
Branch point for: yamt-splraiseipl, newlock2
Changes since 1.135: +2 -110 lines
Diff to previous 1.135 (colored) to selected 1.115 (colored)

remove more vestiges of CCITT, LLC, HDLC, NS, and NSIP.

Revision 1.135 / (download) - annotate - [select for diffs], Sat Aug 5 17:20:54 2006 UTC (17 years, 8 months ago) by pavel
Branch: MAIN
CVS Tags: yamt-pdpolicy-base8, yamt-pdpolicy-base7, abandoned-netbsd-4-base, abandoned-netbsd-4
Changes since 1.134: +3 -2 lines
Diff to previous 1.134 (colored) to selected 1.115 (colored)

defflag PPPOE_SERVER and PPPOE_TERM_UNKNOWN_SESSIONS.

Revision 1.134 / (download) - annotate - [select for diffs], Wed Jun 7 22:33:42 2006 UTC (17 years, 10 months ago) by kardel
Branch: MAIN
CVS Tags: yamt-pdpolicy-base6, gdamore-uart-base, gdamore-uart, chap-midi-nbase, chap-midi-base
Changes since 1.133: +3 -3 lines
Diff to previous 1.133 (colored) to selected 1.115 (colored)

merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
  time.tv_sec -> time_second
- struct timeval mono_time is gone
  mono_time.tv_sec -> time_uptime
- access to time via
	{get,}{micro,nano,bin}time()
	get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
  Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
  NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html

Revision 1.133 / (download) - annotate - [select for diffs], Thu May 18 09:05:51 2006 UTC (17 years, 11 months ago) by liamjfoy
Branch: MAIN
CVS Tags: yamt-pdpolicy-base5, simonb-timecounters-base
Branch point for: chap-midi
Changes since 1.132: +50 -5 lines
Diff to previous 1.132 (colored) to selected 1.115 (colored)

Integrate Common Address Redundancy Procotol (CARP) from OpenBSD

'pseudo-device	carp'

Thanks to: joerg@ christos@ riz@ and others who tested
Ok: core@

Revision 1.132 / (download) - annotate - [select for diffs], Sun May 14 21:19:33 2006 UTC (17 years, 11 months ago) by elad
Branch: MAIN
Changes since 1.131: +3 -2 lines
Diff to previous 1.131 (colored) to selected 1.115 (colored)

integrate kauth.

Revision 1.131 / (download) - annotate - [select for diffs], Fri May 12 01:20:33 2006 UTC (17 years, 11 months ago) by mrg
Branch: MAIN
Changes since 1.130: +8 -5 lines
Diff to previous 1.130 (colored) to selected 1.115 (colored)

since ar_tha() can return NULL, don't pass it directly to functions
that expect real addresses.  explicitly KASSERT() that it is not
NULL in the kernel and just avoid using it userland.

(the kernel could be more defensive about this, but, until now it
would have just crashed anyway.)

Revision 1.130 / (download) - annotate - [select for diffs], Sat Apr 15 02:25:24 2006 UTC (18 years ago) by christos
Branch: MAIN
CVS Tags: elad-kernelauth-base
Changes since 1.129: +4 -4 lines
Diff to previous 1.129 (colored) to selected 1.115 (colored)

Coverity CID 1145: Protect against NULL deref.

Revision 1.129 / (download) - annotate - [select for diffs], Thu Mar 16 15:57:59 2006 UTC (18 years, 1 month ago) by christos
Branch: MAIN
CVS Tags: yamt-pdpolicy-base4, yamt-pdpolicy-base3, peter-altq-base
Branch point for: peter-altq
Changes since 1.128: +15 -8 lines
Diff to previous 1.128 (colored) to selected 1.115 (colored)

Add a new function called ether_snprintf() which takes an external buffer
and a length. The buffer should be 3 * addrlen.
Remove local tap_ether_sprintf(), and use ether_snprintf() instead.

Revision 1.128 / (download) - annotate - [select for diffs], Sun Dec 11 23:05:24 2005 UTC (18 years, 4 months ago) by thorpej
Branch: MAIN
CVS Tags: yamt-uio_vmspace-base5, yamt-uio_vmspace, yamt-pdpolicy-base2, yamt-pdpolicy-base
Branch point for: yamt-pdpolicy, simonb-timecounters, rpaulo-netinet-merge-pcb, elad-kernelauth
Changes since 1.127: +5 -5 lines
Diff to previous 1.127 (colored) to selected 1.115 (colored)

ANSI function decls and application of static.

Revision 1.127 / (download) - annotate - [select for diffs], Sun Dec 11 12:24:51 2005 UTC (18 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.126: +2 -2 lines
Diff to previous 1.126 (colored) to selected 1.115 (colored)

merge ktrace-lwp.

Revision 1.126 / (download) - annotate - [select for diffs], Fri Jun 10 11:11:38 2005 UTC (18 years, 10 months ago) by bouyer
Branch: MAIN
CVS Tags: yamt-vop-base3, yamt-vop-base2, yamt-vop-base, yamt-vop, yamt-readahead-pervnode, yamt-readahead-perfile, yamt-readahead-base3, yamt-readahead-base2, yamt-readahead-base, yamt-readahead, thorpej-vnode-attr-base, thorpej-vnode-attr, ktrace-lwp-base
Branch point for: yamt-lazymbuf
Changes since 1.125: +2 -7 lines
Diff to previous 1.125 (colored) to selected 1.115 (colored)

As ether_input() is always called at IPL_NET, there is no need to
protect the IF_* operations with splnet()/splx().

Revision 1.125 / (download) - annotate - [select for diffs], Sun May 29 21:22:52 2005 UTC (18 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.124: +4 -6 lines
Diff to previous 1.124 (colored) to selected 1.115 (colored)

- sprinkle const
- remove unneeded casts
- use more mem*() instead of b*() funcs.

Revision 1.124 / (download) - annotate - [select for diffs], Tue May 17 04:14:58 2005 UTC (18 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.123: +4 -5 lines
Diff to previous 1.123 (colored) to selected 1.115 (colored)

Yes, it was a cool trick >20 years ago to use "0123456789abcdef"[a] to
implement, xtoa(), but I think defining the samestring 50 times is a bit
too much. Defined HEXDIGITS and hexdigits in subr_prf.c and use it...

Revision 1.123 / (download) - annotate - [select for diffs], Mon May 2 21:20:27 2005 UTC (18 years, 11 months ago) by matt
Branch: MAIN
Changes since 1.122: +12 -4 lines
Diff to previous 1.122 (colored) to selected 1.115 (colored)

rate limit the printfs for oversized ethernet packets.

Revision 1.122 / (download) - annotate - [select for diffs], Thu Mar 31 15:48:13 2005 UTC (19 years ago) by christos
Branch: MAIN
CVS Tags: kent-audio2-base
Changes since 1.121: +4 -24 lines
Diff to previous 1.121 (colored) to selected 1.115 (colored)

factor out the interface queueing code into two functions. One used by
the non point-to-point interfaces that has one queue, and one used by
the point to point interfaces that has two queues. No functional changes.
XXX: The ALTQ stuff makes the code ugly.
XXX: More cleanup to come

Revision 1.121 / (download) - annotate - [select for diffs], Fri Mar 18 11:11:50 2005 UTC (19 years, 1 month ago) by yamt
Branch: MAIN
CVS Tags: yamt-km-base4, yamt-km-base3
Changes since 1.120: +56 -2 lines
Diff to previous 1.120 (colored) to selected 1.115 (colored)

add agr(4), a pseudo network device driver for link aggregation.

Revision 1.120 / (download) - annotate - [select for diffs], Sat Feb 26 22:45:09 2005 UTC (19 years, 1 month ago) by perry
Branch: MAIN
CVS Tags: netbsd-3-base, netbsd-3-1-RELEASE, netbsd-3-1-RC4, netbsd-3-1-RC3, netbsd-3-1-RC2, netbsd-3-1-RC1, netbsd-3-0-RELEASE, netbsd-3-0-RC6, netbsd-3-0-RC5, netbsd-3-0-RC4, netbsd-3-0-RC3, netbsd-3-0-RC2, netbsd-3-0-RC1, netbsd-3-0-2-RELEASE, netbsd-3-0-1-RELEASE
Branch point for: netbsd-3-1, netbsd-3-0, netbsd-3
Changes since 1.119: +21 -21 lines
Diff to previous 1.119 (colored) to selected 1.115 (colored)

nuke trailing whitespace

Revision 1.119 / (download) - annotate - [select for diffs], Mon Jan 31 23:49:36 2005 UTC (19 years, 2 months ago) by kim
Branch: MAIN
CVS Tags: yamt-km-base2
Changes since 1.118: +17 -13 lines
Diff to previous 1.118 (colored) to selected 1.115 (colored)

Add RFC 3378 EtherIP support, ported from OpenBSD to NetBSD by
Hans Rosenfeld (rosenfeld at grumpf.hope-2000.org)

This change makes it possible to add gif interfaces to bridges, which
will then send and receive IP protocol 97 packets. Packets are Ethernet
frames with an EtherIP header prepended.

Revision 1.118 / (download) - annotate - [select for diffs], Sat Jan 8 03:18:18 2005 UTC (19 years, 3 months ago) by yamt
Branch: MAIN
CVS Tags: yamt-km-base, kent-audio1-beforemerge
Branch point for: yamt-km, kent-audio2
Changes since 1.117: +12 -7 lines
Diff to previous 1.117 (colored) to selected 1.115 (colored)

constify broadcastaddr.

Revision 1.117 / (download) - annotate - [select for diffs], Sat Jan 8 03:13:09 2005 UTC (19 years, 3 months ago) by yamt
Branch: MAIN
Changes since 1.116: +2 -3 lines
Diff to previous 1.116 (colored) to selected 1.115 (colored)

remove an unused member, enm_ec from ether_multi.

Revision 1.116 / (download) - annotate - [select for diffs], Thu Jun 24 04:15:51 2004 UTC (19 years, 9 months ago) by jonathan
Branch: MAIN
CVS Tags: kent-audio1-base, kent-audio1
Changes since 1.115: +4 -4 lines
Diff to previous 1.115 (colored)

Rename MBUFTRACE helper function m_claim() to m_claimm(),
for consistency with M_FREE() and m_freem().  Affected files:

sys/mbuf.h
kern/uipc_socket2.c
kern/uipc_mbuf.c
net/if_ethersubr.c
netatalk/ddp_input.c
nfs/nfs_socket.c

Revision 1.115 / (download) - annotate - [selected], Sun Jun 6 04:44:05 2004 UTC (19 years, 10 months ago) by dyoung
Branch: MAIN
Changes since 1.114: +7 -2 lines
Diff to previous 1.114 (colored)

Resolve kern/25721 by detaching ethernet(-like) devices from a
bridge in ether_ifdetach.

Revision 1.114 / (download) - annotate - [select for diffs], Thu Oct 30 01:43:08 2003 UTC (20 years, 5 months ago) by simonb
Branch: MAIN
CVS Tags: netbsd-2-0-base
Branch point for: netbsd-2-0
Changes since 1.113: +3 -5 lines
Diff to previous 1.113 (colored) to selected 1.115 (colored)

Remove some assigned-to but otherwise unused variables.

Revision 1.113 / (download) - annotate - [select for diffs], Thu Aug 7 16:32:51 2003 UTC (20 years, 8 months ago) by agc
Branch: MAIN
Changes since 1.112: +3 -7 lines
Diff to previous 1.112 (colored) to selected 1.115 (colored)

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.

Revision 1.112 / (download) - annotate - [select for diffs], Mon Jun 23 11:02:10 2003 UTC (20 years, 9 months ago) by martin
Branch: MAIN
Branch point for: ktrace-lwp
Changes since 1.111: +4 -2 lines
Diff to previous 1.111 (colored) to selected 1.115 (colored)

Make sure to include opt_foo.h if a defflag option FOO is used.

Revision 1.111 / (download) - annotate - [select for diffs], Wed Jun 11 10:44:10 2003 UTC (20 years, 10 months ago) by martin
Branch: MAIN
Changes since 1.110: +3 -3 lines
Diff to previous 1.110 (colored) to selected 1.115 (colored)

Add NETATALK to the list to check if we bail because no ARP is configured.

Revision 1.110 / (download) - annotate - [select for diffs], Wed Jun 11 10:34:55 2003 UTC (20 years, 10 months ago) by martin
Branch: MAIN
Changes since 1.109: +3 -3 lines
Diff to previous 1.109 (colored) to selected 1.115 (colored)

Fix typpo in #error message. Noted by Pawel Chwalowski in PR 21853.

Revision 1.109 / (download) - annotate - [select for diffs], Fri May 23 10:06:17 2003 UTC (20 years, 10 months ago) by itojun
Branch: MAIN
Changes since 1.108: +4 -2 lines
Diff to previous 1.108 (colored) to selected 1.115 (colored)

don't call if_free_sadl() until very end of if_detach() logic.  many of
routing table manipulation code assumes the presense of AF_LINK sockaddr.
should fix PR 21581

Revision 1.108 / (download) - annotate - [select for diffs], Fri May 16 04:54:55 2003 UTC (20 years, 11 months ago) by itojun
Branch: MAIN
Changes since 1.107: +10 -6 lines
Diff to previous 1.107 (colored) to selected 1.115 (colored)

use strlcpy

Revision 1.107 / (download) - annotate - [select for diffs], Fri May 2 03:15:23 2003 UTC (20 years, 11 months ago) by itojun
Branch: MAIN
Changes since 1.106: +3 -3 lines
Diff to previous 1.106 (colored) to selected 1.115 (colored)

KNF

Revision 1.106 / (download) - annotate - [select for diffs], Tue Mar 25 13:29:39 2003 UTC (21 years ago) by bouyer
Branch: MAIN
Changes since 1.105: +28 -21 lines
Diff to previous 1.105 (colored) to selected 1.115 (colored)

Make promiscous mode work on vlans: introduce a new link-layer m_flag
M_PROMISC. In ether_input(), flag packets comming from an interface in
promiscous mode which are not for us M_PROMISC instead of droping them.
Drop M_PROMISC packets which are not passed to vlan_input(). M_PROMISC
packets passed to vlan_input() will be looped back to ether_input()
the M_PROMISC flag will be handled appropriately.
Clear M_PROMISC before giving the packet to bridge, as bridge has its own
checks for local MAC addresses.
This also makes bridges on vlan working.

Revision 1.105 / (download) - annotate - [select for diffs], Sun Mar 2 10:50:14 2003 UTC (21 years, 1 month ago) by aymeric
Branch: MAIN
Changes since 1.104: +9 -2 lines
Diff to previous 1.104 (colored) to selected 1.115 (colored)

ignore multicast PPPoE packets ASAP.
This improves performance a lot on slow machines behind a cable modem.
Protect it with PPPOE_SERVER as a reminder that this will have to be changed
if we add PPPoE server code in the kernel one day.

Revision 1.104 / (download) - annotate - [select for diffs], Wed Feb 26 06:31:12 2003 UTC (21 years, 1 month ago) by matt
Branch: MAIN
Changes since 1.103: +22 -3 lines
Diff to previous 1.103 (colored) to selected 1.115 (colored)

Add MBUFTRACE kernel option.
Do a little mbuf rework while here.  Change all uses of MGET*(*, M_WAIT, *)
to m_get*(M_WAIT, *).  These are not performance critical and making them
call m_get saves considerable space.  Add m_clget analogue of MCLGET and
make corresponding change for M_WAIT uses.
Modify netinet, gem, fxp, tulip, nfs to support MBUFTRACE.
Begin to change netstat to use sysctl.

Revision 1.103 / (download) - annotate - [select for diffs], Mon Feb 3 23:51:03 2003 UTC (21 years, 2 months ago) by thorpej
Branch: MAIN
Changes since 1.102: +3 -3 lines
Diff to previous 1.102 (colored) to selected 1.115 (colored)

Test callout_pending(), not callout_active(), and eliminate now-unnecessary
callout_deactivate() calls.

Revision 1.102 / (download) - annotate - [select for diffs], Wed Jan 22 11:47:05 2003 UTC (21 years, 2 months ago) by jmmv
Branch: MAIN
Changes since 1.101: +4 -4 lines
Diff to previous 1.101 (colored) to selected 1.115 (colored)

Fix typo: realy -> really.  Okay'ed by wiz.

Revision 1.101 / (download) - annotate - [select for diffs], Fri Jan 17 08:11:55 2003 UTC (21 years, 3 months ago) by itojun
Branch: MAIN
CVS Tags: nathanw_sa_before_merge, nathanw_sa_base
Changes since 1.100: +4 -4 lines
Diff to previous 1.100 (colored) to selected 1.115 (colored)

switch from kame-based m_aux mbuf auxiliary data, to openbsd m_tag
implementation.  it will simplify porting across *bsd (such as kame/altq),
and make us more synchronized.  from Joel Wilsson

Revision 1.100 / (download) - annotate - [select for diffs], Sun Jan 12 12:26:23 2003 UTC (21 years, 3 months ago) by jdolecek
Branch: MAIN
Changes since 1.99: +3 -3 lines
Diff to previous 1.99 (colored) to selected 1.115 (colored)

Ethernet multicast entries are malloc'd M_IFMADDR, and thus should
be freed as M_IFMADDR too.
Fix supplied in PR kern/19037 by Sean Boudreau

Revision 1.99 / (download) - annotate - [select for diffs], Wed Sep 11 05:36:26 2002 UTC (21 years, 7 months ago) by itojun
Branch: MAIN
CVS Tags: kqueue-beforemerge, kqueue-base, kqueue-aftermerge, gmcgarry_ucred_base, gmcgarry_ucred, gmcgarry_ctxsw_base, gmcgarry_ctxsw, fvdl_fs64_base
Changes since 1.98: +3 -3 lines
Diff to previous 1.98 (colored) to selected 1.115 (colored)

KNF - return is not a function.

Revision 1.98 / (download) - annotate - [select for diffs], Mon Aug 26 01:39:39 2002 UTC (21 years, 7 months ago) by thorpej
Branch: MAIN
CVS Tags: gehenna-devsw-base
Changes since 1.97: +4 -4 lines
Diff to previous 1.97 (colored) to selected 1.115 (colored)

Fix some signed/unsigned comparison warnings from GCC 3.3.

Revision 1.97 / (download) - annotate - [select for diffs], Tue Aug 20 03:32:08 2002 UTC (21 years, 8 months ago) by kristerw
Branch: MAIN
Changes since 1.96: +3 -3 lines
Diff to previous 1.96 (colored) to selected 1.115 (colored)

Make it compile for the __NO_STRICT_ALIGNMENT case.

Revision 1.96 / (download) - annotate - [select for diffs], Mon Aug 19 18:58:50 2002 UTC (21 years, 8 months ago) by thorpej
Branch: MAIN
Changes since 1.95: +17 -4 lines
Diff to previous 1.95 (colored) to selected 1.115 (colored)

In ether_output(), don't bother calling memcpy() to plop the ethertype
into the packet: On system with no strict alignment constraints, just
assign the value, and on others, do an inline 2 byte copy.

Revision 1.95 / (download) - annotate - [select for diffs], Sat May 18 22:52:44 2002 UTC (21 years, 11 months ago) by itojun
Branch: MAIN
CVS Tags: netbsd-1-6-base, netbsd-1-6-RELEASE, netbsd-1-6-RC3, netbsd-1-6-RC2, netbsd-1-6-RC1
Branch point for: netbsd-1-6
Changes since 1.94: +8 -5 lines
Diff to previous 1.94 (colored) to selected 1.115 (colored)

sync with KAME.
- make altq_etherclassify() able to handle packets whose ethernet header
  is in a separate mbuf.  closes netbsd PR 16559

Revision 1.94 / (download) - annotate - [select for diffs], Sat Apr 27 02:38:47 2002 UTC (21 years, 11 months ago) by enami
Branch: MAIN
Branch point for: gehenna-devsw
Changes since 1.93: +3 -3 lines
Diff to previous 1.93 (colored) to selected 1.115 (colored)

Use ETHER_HDR_LEN instead of 14.

Revision 1.93 / (download) - annotate - [select for diffs], Sun Apr 7 07:05:37 2002 UTC (22 years ago) by martin
Branch: MAIN
Changes since 1.92: +10 -2 lines
Diff to previous 1.92 (colored) to selected 1.115 (colored)

XXX Explicitly make this fail to compile with a proper warning if we
do not have ARP configured.

This can be caused by configurations including bridge, ppppoe or vlan but
no ethernet interfaces - which does not make sense. We should add a way
to config(8) to issue this kind of warnings.

Revision 1.92 / (download) - annotate - [select for diffs], Tue Mar 5 04:13:00 2002 UTC (22 years, 1 month ago) by itojun
Branch: MAIN
CVS Tags: newlock-base, newlock, eeh-devprop-base, eeh-devprop
Changes since 1.91: +4 -2 lines
Diff to previous 1.91 (colored) to selected 1.115 (colored)

bring in latest ALTQ from kjc.  ALTQify some of the drivers.

Revision 1.91 / (download) - annotate - [select for diffs], Thu Feb 28 19:23:03 2002 UTC (22 years, 1 month ago) by thorpej
Branch: MAIN
CVS Tags: ifpoll-base
Changes since 1.90: +13 -9 lines
Diff to previous 1.90 (colored) to selected 1.115 (colored)

Don't call m_aux_find() to find a VLAN tag unless VLANs are configured
on the interface.

Revision 1.90 / (download) - annotate - [select for diffs], Mon Nov 12 23:49:37 2001 UTC (22 years, 5 months ago) by lukem
Branch: MAIN
Changes since 1.89: +4 -1 lines
Diff to previous 1.89 (colored) to selected 1.115 (colored)

add RCSIDs

Revision 1.89 / (download) - annotate - [select for diffs], Wed Oct 17 08:23:05 2001 UTC (22 years, 6 months ago) by itojun
Branch: MAIN
CVS Tags: thorpej-mips-cache-base, thorpej-mips-cache
Changes since 1.88: +1 -6 lines
Diff to previous 1.88 (colored) to selected 1.115 (colored)

unifdef OLDIP6OUTPUT

Revision 1.88 / (download) - annotate - [select for diffs], Wed Jul 25 03:18:46 2001 UTC (22 years, 8 months ago) by thorpej
Branch: MAIN
CVS Tags: thorpej-devvp-base3, thorpej-devvp-base2, thorpej-devvp-base, thorpej-devvp, pre-chs-ubcperf, post-chs-ubcperf
Changes since 1.87: +6 -5 lines
Diff to previous 1.87 (colored) to selected 1.115 (colored)

Duh, braino in last -- only kick the interface if we actually set
the MTU.

Revision 1.87 / (download) - annotate - [select for diffs], Wed Jul 25 03:05:33 2001 UTC (22 years, 8 months ago) by thorpej
Branch: MAIN
Changes since 1.86: +5 -1 lines
Diff to previous 1.86 (colored) to selected 1.115 (colored)

If we change the MTU, kick the interface; it may have to reprogram
registers for the new MTU.

Revision 1.86 / (download) - annotate - [select for diffs], Fri Jun 29 18:12:09 2001 UTC (22 years, 9 months ago) by thorpej
Branch: MAIN
Branch point for: kqueue
Changes since 1.85: +5 -3 lines
Diff to previous 1.85 (colored) to selected 1.115 (colored)

When setting an address on an interface, for address families which
do not require changing the link-level address, only (*if_init)()
if the interface is not already RUNNING.

Revision 1.85 / (download) - annotate - [select for diffs], Thu Jun 14 05:44:24 2001 UTC (22 years, 10 months ago) by itojun
Branch: MAIN
Changes since 1.84: +1 -3 lines
Diff to previous 1.84 (colored) to selected 1.115 (colored)

change the meaning of ifnet.if_lastchange to meet RFC1573 ifLastChange.
follows BSD/OS practice and ucd-snmp code (FreeBSD does it for specific
interfaces only).

was: if_lastchange get updated on every packet transmission/receipt.
now: if_lastchange get updated when IFF_UP is changed.

Revision 1.84 / (download) - annotate - [select for diffs], Tue Jun 12 15:03:26 2001 UTC (22 years, 10 months ago) by thorpej
Branch: MAIN
Changes since 1.83: +21 -9 lines
Diff to previous 1.83 (colored) to selected 1.115 (colored)

On a non-simplex interface, check incoming multicast (this catches
the broadcast case as well) to see if they came from us, and drop
them if they did.

This fixed IPv6 DAD on non-simplex interfaces, e.g. the Seeq 8003
found on my SGI Indy.

Revision 1.83 / (download) - annotate - [select for diffs], Sun Jun 3 03:24:23 2001 UTC (22 years, 10 months ago) by thorpej
Branch: MAIN
Changes since 1.82: +3 -2 lines
Diff to previous 1.82 (colored) to selected 1.115 (colored)

Consider the configured MTU of the interface when determining
if a packet is too large.

Revision 1.82 / (download) - annotate - [select for diffs], Sun Jun 3 03:07:39 2001 UTC (22 years, 10 months ago) by thorpej
Branch: MAIN
Changes since 1.81: +11 -2 lines
Diff to previous 1.81 (colored) to selected 1.115 (colored)

Add a capability bit that indicates support for Gigabit Ethernet
jumbo frames, and use it in SIOCSIFMTU.

Revision 1.81 / (download) - annotate - [select for diffs], Sun Apr 29 09:50:37 2001 UTC (22 years, 11 months ago) by martin
Branch: MAIN
Changes since 1.80: +29 -1 lines
Diff to previous 1.80 (colored) to selected 1.115 (colored)

Add an in-kernel PPPoE (ppp over ethernet, RFC 2516) implementation,
based on the existing net/if_spppsubr.c stuff.

While there are completely userland (bpf based) implementations available,
those have a vastly larger per packet overhead thus causing major CPU
overhead and higher latency. On an i386 base router, running a 486DX at 50MHz
my line (768kBit/s downstream) was limited to something (varying) between 10
and 20 kByte/s effective download rate. With this implementation I get full
bandwidth (~85kByte/s).

This is client side only. Arguably the right way to add full PPPoE support
(including server side) would be a variation of the ppp line discipline and
appropriate modifications to pppd. I promise every help I can give to anyone
doing that - but I needed this realy fast. Besids, on low memory NAT boxes
with typically a single PPPoE connection, this implementation is more
lightweight than a pppd based one, which nicely fits my needs.

Revision 1.80 / (download) - annotate - [select for diffs], Fri Apr 27 00:14:02 2001 UTC (22 years, 11 months ago) by marcus
Branch: MAIN
Changes since 1.79: +2 -2 lines
Diff to previous 1.79 (colored) to selected 1.115 (colored)

STDC cleanup: label not allowed just before end of block.

Revision 1.79 / (download) - annotate - [select for diffs], Fri Apr 13 23:30:12 2001 UTC (23 years ago) by thorpej
Branch: MAIN
CVS Tags: thorpej_scsipi_nbase, thorpej_scsipi_beforemerge, thorpej_scsipi_base
Changes since 1.78: +15 -7 lines
Diff to previous 1.78 (colored) to selected 1.115 (colored)

Remove the use of splimp() from the NetBSD kernel.  splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.

Revision 1.78 / (download) - annotate - [select for diffs], Wed Apr 11 03:47:24 2001 UTC (23 years ago) by thorpej
Branch: MAIN
Changes since 1.77: +58 -15 lines
Diff to previous 1.77 (colored) to selected 1.115 (colored)

Add hooks for bridging.

Revision 1.77 / (download) - annotate - [select for diffs], Tue Apr 10 21:47:36 2001 UTC (23 years ago) by thorpej
Branch: MAIN
Changes since 1.76: +31 -7 lines
Diff to previous 1.76 (colored) to selected 1.115 (colored)

Process pfil hooks for Ethernet input and output.

Revision 1.76 / (download) - annotate - [select for diffs], Sat Apr 7 18:01:48 2001 UTC (23 years ago) by thorpej
Branch: MAIN
Changes since 1.75: +88 -1 lines
Diff to previous 1.75 (colored) to selected 1.115 (colored)

Add altq_etherclassify(), a slight hack modified from the kame/freebsd4
tree, which allows a packet with Ethernet headers already present to
run through the ALTQ packet classifier.  This is needed in order to
suport ALTQ on VLAN and bridge devices.

Revision 1.75 / (download) - annotate - [select for diffs], Wed Jan 17 00:30:51 2001 UTC (23 years, 3 months ago) by thorpej
Branch: MAIN
Branch point for: nathanw_sa
Changes since 1.74: +25 -13 lines
Diff to previous 1.74 (colored) to selected 1.115 (colored)

Fix a rather annoying problem where the sockaddr_dl which holds
the link level name for the interface (ifp->if_sadl) is allocated
before ifp->if_addrlen is initialized, which could lead to allocating
too little space for the link level address.

Do this by splitting allocation of the link level name out of
if_attach() and into if_alloc_sadl(), which is normally called
by functions like ether_ifattach().  Network interfaces which
don't have a link-specific attach routine must call if_alloc_sadl()
themselves (example: gif).

Link level names are freed by if_free_sadl(), which can be called
from e.g. ether_ifdetach().  Drivers never need call if_free_sadl()
themselves as if_detach() will do it if it is not already done.

While here, add the ability to pass an AF_LINK address to
SIOCSIFADDR in ether_ioctl() (this is what caused me to notice
the problem that the above fixes).

Revision 1.74 / (download) - annotate - [select for diffs], Tue Dec 26 23:54:34 2000 UTC (23 years, 3 months ago) by augustss
Branch: MAIN
Changes since 1.73: +5 -4 lines
Diff to previous 1.73 (colored) to selected 1.115 (colored)

Simplify case statement a tiny bit.

Revision 1.73 / (download) - annotate - [select for diffs], Mon Dec 18 19:44:33 2000 UTC (23 years, 4 months ago) by thorpej
Branch: MAIN
Changes since 1.72: +2 -1 lines
Diff to previous 1.72 (colored) to selected 1.115 (colored)

Fill in if_dlt.

Revision 1.72 / (download) - annotate - [select for diffs], Wed Dec 13 22:07:50 2000 UTC (23 years, 4 months ago) by thorpej
Branch: MAIN
Changes since 1.71: +19 -8 lines
Diff to previous 1.71 (colored) to selected 1.115 (colored)

Add ALTQ glue.

Revision 1.71 / (download) - annotate - [select for diffs], Tue Dec 12 18:00:25 2000 UTC (23 years, 4 months ago) by thorpej
Branch: MAIN
Changes since 1.70: +2 -2 lines
Diff to previous 1.70 (colored) to selected 1.115 (colored)

Adapt to bpfattach() changes, and further centralize the bpfattach()
and bpfdetach() calls into link-type subroutines where possible.

Revision 1.70 / (download) - annotate - [select for diffs], Fri Nov 17 19:21:53 2000 UTC (23 years, 5 months ago) by bouyer
Branch: MAIN
Changes since 1.69: +18 -1 lines
Diff to previous 1.69 (colored) to selected 1.115 (colored)

Supports hardware 802.1q VLAN tagging, per discussion on tech-net. The tag is
stored in a m_aux mbuf defined by AF_LINK, ETHERTYPE_VLAN.
Thanks to Jason & Itojun for the feedback.

Revision 1.69 / (download) - annotate - [select for diffs], Wed Nov 15 01:02:15 2000 UTC (23 years, 5 months ago) by thorpej
Branch: MAIN
Changes since 1.68: +13 -1 lines
Diff to previous 1.68 (colored) to selected 1.115 (colored)

Move bpfattach()/bpfdetach() calls into ether_ifattach()/ether_ifdetach().

Revision 1.68 / (download) - annotate - [select for diffs], Sun Oct 15 19:49:55 2000 UTC (23 years, 6 months ago) by matt
Branch: MAIN
Changes since 1.67: +3 -2 lines
Diff to previous 1.67 (colored) to selected 1.115 (colored)

When discarding oversized frame, say how long it was.

Revision 1.67 / (download) - annotate - [select for diffs], Sun Oct 15 15:39:11 2000 UTC (23 years, 6 months ago) by itojun
Branch: MAIN
Changes since 1.66: +2 -3 lines
Diff to previous 1.66 (colored) to selected 1.115 (colored)

suppress warning on nd6_storelladdr failure.  the failure could happen
easily when we have routing table with too many entries.  sync with kame.

Revision 1.66 / (download) - annotate - [select for diffs], Wed Oct 11 16:53:41 2000 UTC (23 years, 6 months ago) by thorpej
Branch: MAIN
Changes since 1.65: +95 -2 lines
Diff to previous 1.65 (colored) to selected 1.115 (colored)

Implement ether_ioctl(), ioctl operations common to all Ethernet
interfaces.

Revision 1.65 / (download) - annotate - [select for diffs], Wed Oct 4 07:01:52 2000 UTC (23 years, 6 months ago) by enami
Branch: MAIN
Changes since 1.64: +3 -1 lines
Diff to previous 1.64 (colored) to selected 1.115 (colored)

Free mbuf when dropping VLAN frame due to no configured vlan interface.

Revision 1.64 / (download) - annotate - [select for diffs], Tue Oct 3 23:50:52 2000 UTC (23 years, 6 months ago) by thorpej
Branch: MAIN
Changes since 1.63: +6 -1 lines
Diff to previous 1.63 (colored) to selected 1.115 (colored)

When an Ethernet interface detaches, unconfigure any VLANs associated
with it.

Revision 1.63 / (download) - annotate - [select for diffs], Tue Oct 3 23:33:38 2000 UTC (23 years, 6 months ago) by thorpej
Branch: MAIN
Changes since 1.62: +28 -5 lines
Diff to previous 1.62 (colored) to selected 1.115 (colored)

Improve the VLAN support, in particular, handling of MTU:
- Add a macro to compute the max frame length based on Ethertype
  and presence of FCS, and use it to validate the packet size
  in ether_input().
- Add capabilites to struct ethercom, and allow hardware drivers
  to specify that they can handle the larger hardware MTU that
  VLANs require in order to strictly conform to 802.1Q.
- Make ether_ifdetach() clear out the link address and free all of
  the Ethernet multicast structures.

Also, rearrange the VLAN driver itself in preparation to supporting
other hardware types, including FDDI (which has 802.1Q VLAN capability).

Revision 1.62 / (download) - annotate - [select for diffs], Sun Oct 1 23:43:44 2000 UTC (23 years, 6 months ago) by thorpej
Branch: MAIN
Changes since 1.61: +4 -12 lines
Diff to previous 1.61 (colored) to selected 1.115 (colored)

Make the previous code path simpler (and possible easier for the
compiler to optimize), based on fddi_input().

Revision 1.61 / (download) - annotate - [select for diffs], Sun Oct 1 23:32:45 2000 UTC (23 years, 6 months ago) by thorpej
Branch: MAIN
Changes since 1.60: +16 -4 lines
Diff to previous 1.60 (colored) to selected 1.115 (colored)

Move the check for "promisc + unicast + not for us" into ether_input(),
and change Ethernet drivers to always pass all received frames to
ether_input() (with a few exceptions, which are documented in the
code).

Revision 1.60 / (download) - annotate - [select for diffs], Thu Sep 28 07:15:28 2000 UTC (23 years, 6 months ago) by enami
Branch: MAIN
Changes since 1.59: +46 -79 lines
Diff to previous 1.59 (colored) to selected 1.115 (colored)

Factor out and give a name to the common functionality to translate
sockaddr which represents a multicast address into an Ethernet address
or range of Etherenet addresses.

Revision 1.59 / (download) - annotate - [select for diffs], Wed Sep 27 22:58:21 2000 UTC (23 years, 6 months ago) by thorpej
Branch: MAIN
Changes since 1.58: +23 -1 lines
Diff to previous 1.58 (colored) to selected 1.115 (colored)

Glue VLANs into ether_input().

Revision 1.58 / (download) - annotate - [select for diffs], Sat Jun 17 20:57:20 2000 UTC (23 years, 10 months ago) by matt
Branch: MAIN
CVS Tags: netbsd-1-5-base, netbsd-1-5-RELEASE, netbsd-1-5-BETA2, netbsd-1-5-BETA, netbsd-1-5-ALPHA2
Branch point for: netbsd-1-5
Changes since 1.57: +12 -31 lines
Diff to previous 1.57 (colored) to selected 1.115 (colored)

Ansify before committing my next change.

Revision 1.57 / (download) - annotate - [select for diffs], Wed Jun 14 05:10:27 2000 UTC (23 years, 10 months ago) by mycroft
Branch: MAIN
Changes since 1.56: +3 -3 lines
Diff to previous 1.56 (colored) to selected 1.115 (colored)

Check the multicast bit in the header mbuf while interrupts are still blocked.
Otherwise we can run off into space if the packet was sent immediately and the
mbuf freed.
Pointed out by Boris Popov (not on our lists).

Revision 1.56 / (download) - annotate - [select for diffs], Fri May 12 16:22:36 2000 UTC (23 years, 11 months ago) by thorpej
Branch: MAIN
CVS Tags: minoura-xpg4dl-base
Branch point for: minoura-xpg4dl
Changes since 1.55: +34 -2 lines
Diff to previous 1.55 (colored) to selected 1.115 (colored)

- Fix a bug in the double-loop version of ether_crc32_le() -- we're not't
  supposed to bubble carry through.
- Disable the double-loop version of ether_crc32_le() and add a
  table-driven version of ether_crc32_le() -- the table-driven
  version is faster.

Revision 1.55 / (download) - annotate - [select for diffs], Wed Apr 12 10:36:43 2000 UTC (24 years ago) by itojun
Branch: MAIN
Changes since 1.54: +1 -5 lines
Diff to previous 1.54 (colored) to selected 1.115 (colored)

revisit in6_ifattach().
- be persistent on initializing interfaces, even if there's manually-
  assigned linklocal, multicast/whatever initialization is necessary.
- do not cache mac addr in the kernel.  grab mac addr from existing cards
  (this is important when you swap ethernet cards back and forth)
now ppp6 works just fine!

call in6_ifattach() on ATM PVC interface to assign link-local, using
hardware MAC address as seed.

(the change is in sync with kame tree).

Revision 1.54 / (download) - annotate - [select for diffs], Mon Mar 6 21:03:46 2000 UTC (24 years, 1 month ago) by thorpej
Branch: MAIN
Changes since 1.53: +3 -2 lines
Diff to previous 1.53 (colored) to selected 1.115 (colored)

On second thought, only set a default baudrate for "ethernet" if one
isn't set already.

Revision 1.53 / (download) - annotate - [select for diffs], Mon Mar 6 20:54:41 2000 UTC (24 years, 1 month ago) by thorpej
Branch: MAIN
Changes since 1.52: +50 -1 lines
Diff to previous 1.52 (colored) to selected 1.115 (colored)

- Initialize ifp->if_baudrate to a sensible value when the interface is
  attached.
- Add ether_crc32_be() and ether_crc_le(), common functions for computing
  the Ethernet CRC on arbitrary length buffers.  Nothing uses them yet,
  and these should be double-checked and probably re-implemented as
  table-driven functions.

Revision 1.52 / (download) - annotate - [select for diffs], Tue Feb 1 22:52:05 2000 UTC (24 years, 2 months ago) by thorpej
Branch: MAIN
CVS Tags: chs-ubc2-newbase
Changes since 1.51: +9 -1 lines
Diff to previous 1.51 (colored) to selected 1.115 (colored)

First-draft if_detach() implementation, originally from Bill Studnemund,
although this version has been changed somewhat:
- reference counting on ifaddrs isn't as complete as Bill's original
  work was.  This is hard to get right, and we should attack one
  protocol at a time.
- This doesn't do reference counting or dynamic allocation of ifnets yet.
- This version introduces a new PRU -- PRU_PURGEADDR, which is used to
  purge an ifaddr from a protocol.  The old method Bill used didn't work
  on all protocols, and it only worked on some because it was Very Lucky.

This mostly works ... i.e. works for my USB Ethernet, except for a dangling
ifaddr reference left by the IPv6 code; have not yet tracked this down.

Revision 1.51 / (download) - annotate - [select for diffs], Mon Dec 13 15:17:19 1999 UTC (24 years, 4 months ago) by itojun
Branch: MAIN
CVS Tags: wrstuden-devbsize-base, wrstuden-devbsize-19991221
Changes since 1.50: +9 -6 lines
Diff to previous 1.50 (colored) to selected 1.115 (colored)

sync IPv6 part with latest KAME tree.   IPsec part is left unmodified
due to massive changes in KAME side.
- IPv6 output goes through nd6_output
- faith can capture IPv4 packets as well - you can run IPv4-to-IPv6 translator
  using heavily modified DNS servers
- per-interface statistics (required for IPv6 MIB)
- interface autoconfig is revisited
- udp input handling has a big change for mapped address support.
- introduce in4_cksum() for non-overwriting checksumming
- introduce m_pulldown()
- neighbor discovery cleanups/improvements
- netinet/in.h strictly conforms to RFC2553 (no extra defs visible to userland)
- IFA_STATS is fixed a bit (not tested)
- and more more more.

TODO:
- cleanup os-independency #ifdef
- avoid rcvif dual use (for IPsec) to help ifdetach

(sorry for jumbo commit, I can't separate this any more...)

Revision 1.50 / (download) - annotate - [select for diffs], Tue Oct 12 04:53:45 1999 UTC (24 years, 6 months ago) by matt
Branch: MAIN
CVS Tags: fvdl-softdep-base, fvdl-softdep, comdex-fall-1999-base, comdex-fall-1999
Branch point for: thorpej_scsipi
Changes since 1.49: +5 -3 lines
Diff to previous 1.49 (colored) to selected 1.115 (colored)

Fix appletalk over ethernet.

Revision 1.49 / (download) - annotate - [select for diffs], Tue Sep 21 22:18:51 1999 UTC (24 years, 7 months ago) by matt
Branch: MAIN
Branch point for: wrstuden-devbsize
Changes since 1.48: +4 -5 lines
Diff to previous 1.48 (colored) to selected 1.115 (colored)

Make NETATALK over FDDI.

Revision 1.48 / (download) - annotate - [select for diffs], Wed Sep 15 20:48:19 1999 UTC (24 years, 7 months ago) by is
Branch: MAIN
Changes since 1.47: +3 -1 lines
Diff to previous 1.47 (colored) to selected 1.115 (colored)

We only need the ether_ipmulticast_min and _max addresses if we have INET
compiled in.

Revision 1.47 / (download) - annotate - [select for diffs], Mon Sep 13 12:15:54 1999 UTC (24 years, 7 months ago) by itojun
Branch: MAIN
Changes since 1.46: +7 -3 lines
Diff to previous 1.46 (colored) to selected 1.115 (colored)

- Call in{,6}_pcbdetach if ipsec initialization is failed during PRU_ATTACH.
  This situation happens on severe memory shortage.  We may need more
  improvements here and there.
- Grab IEEE802 address from IFT_ETHER card, even if the card is
  inserted after bootup time.  Is there any other card that can be
  inserted afterwards?  pcmcia fddi card? :-P
- RFC2373 u bit handling suggests that we SHOULD NOT copy interface id from
  ethernet card to pseudo interface, when ethernet card has IEEE802/EUI64
  with u bit != 0 (this means that IEEE802/EUI64 is not universally unique).
  Do not use such address as, for example, interface id for gif interface.
  (I have such an ethernet card myself)
  This may change interface id for your gif interface.  be careful upgrading
  rc files.

(sync with recent KAME)

Revision 1.46 / (download) - annotate - [select for diffs], Thu Aug 5 02:07:39 1999 UTC (24 years, 8 months ago) by thorpej
Branch: MAIN
Changes since 1.45: +2 -2 lines
Diff to previous 1.45 (colored) to selected 1.115 (colored)

M_HASCRC -> M_HASFCS, as suggested by Christoph Badura.

Revision 1.45 / (download) - annotate - [select for diffs], Wed Aug 4 19:29:01 1999 UTC (24 years, 8 months ago) by thorpej
Branch: MAIN
Changes since 1.44: +5 -1 lines
Diff to previous 1.44 (colored) to selected 1.115 (colored)

In ether_input(), if M_HASCRC is set, trim the CRC off the packet.

Revision 1.44 / (download) - annotate - [select for diffs], Thu Jul 1 08:12:48 1999 UTC (24 years, 9 months ago) by itojun
Branch: MAIN
CVS Tags: chs-ubc2-base
Changes since 1.43: +104 -1 lines
Diff to previous 1.43 (colored) to selected 1.115 (colored)

IPv6 kernel code, based on KAME/NetBSD 1.4, SNAP kit 19990628.
(Sorry for a big commit, I can't separate this into several pieces...)
Pls check sys/netinet6/TODO and sys/netinet6/IMPLEMENTATION for details.

- sys/kern: do not assume single mbuf, accept chained mbuf on passing
  data from userland to kernel (or other way round).
- "midway" ATM card: ATM PVC pseudo device support, like those done in ALTQ
  package (ftp://ftp.csl.sony.co.jp/pub/kjc/).
- sys/netinet/tcp*: IPv4/v6 dual stack tcp support.
- sys/netinet/{ip6,icmp6}.h, sys/net/pfkeyv2.h: IETF document assumes those
  file to be there so we patch it up.
- sys/netinet: IPsec additions are here and there.
- sys/netinet6/*: most of IPv6 code sits here.
- sys/netkey: IPsec key management code
- dev/pci/pcidevs: regen

In my understanding no code here is subject to export control so it
should be safe.

Revision 1.43 / (download) - annotate - [select for diffs], Thu Jun 17 17:27:13 1999 UTC (24 years, 10 months ago) by bouyer
Branch: MAIN
Changes since 1.42: +2 -2 lines
Diff to previous 1.42 (colored) to selected 1.115 (colored)

mbuf should be allocated with M_DONTWAIT in ether_output(). This caused panics
when routing atalk.

Revision 1.42 / (download) - annotate - [select for diffs], Tue May 18 23:57:20 1999 UTC (24 years, 11 months ago) by thorpej
Branch: MAIN
Changes since 1.41: +20 -8 lines
Diff to previous 1.41 (colored) to selected 1.115 (colored)

Rework layer 2 protocol input routines.  Instead of calling e.g. ether_input()
directly, call the function pointer (*if_input)(ifp, m).  The input routine
expects the packet header to be at the head of the packet, and will adjust
as necessary.  Privatize the layer 2 input and output routines, allowing
*_ifattach() to set them up as appropriate.

Revision 1.41 / (download) - annotate - [select for diffs], Wed Mar 10 21:05:08 1999 UTC (25 years, 1 month ago) by thorpej
Branch: MAIN
CVS Tags: netbsd-1-4-base, netbsd-1-4-RELEASE
Branch point for: netbsd-1-4, kame, chs-ubc2
Changes since 1.40: +3 -3 lines
Diff to previous 1.40 (colored) to selected 1.115 (colored)

Const poison ether_ifattach().

Revision 1.40 / (download) - annotate - [select for diffs], Wed Mar 10 03:28:50 1999 UTC (25 years, 1 month ago) by thorpej
Branch: MAIN
Changes since 1.39: +2 -2 lines
Diff to previous 1.39 (colored) to selected 1.115 (colored)

Const poison ether_sprintf().

Revision 1.39 / (download) - annotate - [select for diffs], Thu Dec 10 15:50:54 1998 UTC (25 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.38: +3 -5 lines
Diff to previous 1.38 (colored) to selected 1.115 (colored)

IPX fixes.

Revision 1.38 / (download) - annotate - [select for diffs], Tue Oct 13 02:34:32 1998 UTC (25 years, 6 months ago) by kim
Branch: MAIN
CVS Tags: kenh-if-detach-base, chs-ubc-base, chs-ubc
Branch point for: kenh-if-detach
Changes since 1.37: +5 -5 lines
Diff to previous 1.37 (colored) to selected 1.115 (colored)

Use ETHERTYPE_ATALK instead of ETHERTYPE_AT.  The former seems more common.
Our other constants also use "ATALK".

Added many new ETHERTYPE constants to sys/net/ethertypes.h, including the
ones from libpcap and tcpdump "ethertype.h" files.

Revision 1.37 / (download) - annotate - [select for diffs], Sun Jul 5 06:49:16 1998 UTC (25 years, 9 months ago) by jonathan
Branch: MAIN
CVS Tags: eeh-paddr_t-base, eeh-paddr_t
Changes since 1.36: +2 -1 lines
Diff to previous 1.36 (colored) to selected 1.115 (colored)

defopt NS, NSIP.

Revision 1.36 / (download) - annotate - [select for diffs], Sun Jul 5 04:37:41 1998 UTC (25 years, 9 months ago) by jonathan
Branch: MAIN
Changes since 1.35: +2 -1 lines
Diff to previous 1.35 (colored) to selected 1.115 (colored)

defopt ISO TPIP.

Revision 1.35 / (download) - annotate - [select for diffs], Sun Jul 5 03:14:43 1998 UTC (25 years, 9 months ago) by jonathan
Branch: MAIN
Changes since 1.34: +2 -1 lines
Diff to previous 1.34 (colored) to selected 1.115 (colored)

defopt LLC

Revision 1.34 / (download) - annotate - [select for diffs], Sun Jul 5 02:12:33 1998 UTC (25 years, 9 months ago) by jonathan
Branch: MAIN
Changes since 1.33: +2 -1 lines
Diff to previous 1.33 (colored) to selected 1.115 (colored)

defopt CCITT.

Revision 1.33 / (download) - annotate - [select for diffs], Sun Jul 5 00:51:26 1998 UTC (25 years, 9 months ago) by jonathan
Branch: MAIN
Changes since 1.32: +3 -1 lines
Diff to previous 1.32 (colored) to selected 1.115 (colored)

defopt INET, NETATALK.

Revision 1.32 / (download) - annotate - [select for diffs], Mon May 4 12:54:22 1998 UTC (25 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.31: +24 -1 lines
Diff to previous 1.31 (colored) to selected 1.115 (colored)

Add IPX bits.

Revision 1.31 / (download) - annotate - [select for diffs], Thu Apr 30 00:05:41 1998 UTC (25 years, 11 months ago) by thorpej
Branch: MAIN
Changes since 1.30: +15 -5 lines
Diff to previous 1.30 (colored) to selected 1.115 (colored)

In ether_output(), if the socket address family is pseudo_AF_HDRCMPLT,
use the Ethernet source address speficied in the sockaddr rather than
the interface's Ethernet address, and then fall through to the AF_UNSPEC
case.  From Greg Smith <greg@nas.nasa.gov>.

Revision 1.30 / (download) - annotate - [select for diffs], Wed Apr 29 21:37:53 1998 UTC (25 years, 11 months ago) by matt
Branch: MAIN
Changes since 1.29: +7 -1 lines
Diff to previous 1.29 (colored) to selected 1.115 (colored)

Add support for "fast" forwarding.  Add hooks in if_ethersubr.c and
if_fddisubr.c to fastpath IP forwarding.  If ip_forward successfully
forwards a packet, it will create a cache (ipflow) entry.  ether_input
and fddi_input will first call ipflow_fastforward with the received
packet and if the packet passes enough tests, it will be forwarded (the
ttl is decremented and the cksum is adjusted incrementally).

Revision 1.29 / (download) - annotate - [select for diffs], Sun Apr 26 06:17:20 1998 UTC (25 years, 11 months ago) by mrg
Branch: MAIN
Changes since 1.28: +21 -21 lines
Diff to previous 1.28 (colored) to selected 1.115 (colored)

remove some register.

Revision 1.28 / (download) - annotate - [select for diffs], Tue Mar 24 12:57:15 1998 UTC (26 years ago) by kleink
Branch: MAIN
Changes since 1.27: +2 -2 lines
Diff to previous 1.27 (colored) to selected 1.115 (colored)

register -> register int

Revision 1.27 / (download) - annotate - [select for diffs], Sun Mar 1 02:25:05 1998 UTC (26 years, 1 month ago) by fvdl
Branch: MAIN
Changes since 1.26: +15 -5 lines
Diff to previous 1.26 (colored) to selected 1.115 (colored)

Merge with Lite2 + local changes

Revision 1.26 / (download) - annotate - [select for diffs], Thu Oct 2 19:41:59 1997 UTC (26 years, 6 months ago) by is
Branch: MAIN
CVS Tags: netbsd-1-3-base, netbsd-1-3-RELEASE, netbsd-1-3-PATCH003-CANDIDATE2, netbsd-1-3-PATCH003-CANDIDATE1, netbsd-1-3-PATCH003-CANDIDATE0, netbsd-1-3-PATCH003, netbsd-1-3-PATCH002, netbsd-1-3-PATCH001, netbsd-1-3-BETA, netbsd-1-3, marc-pcmcia-base
Changes since 1.25: +2 -1 lines
Diff to previous 1.25 (colored) to selected 1.115 (colored)

Reimplement a test for broadcast addresses advertized, which was left out
when rewriting the ARP system.

Revision 1.25 / (download) - annotate - [select for diffs], Thu Apr 3 18:48:28 1997 UTC (27 years ago) by christos
Branch: MAIN
CVS Tags: thorpej-signal-base, thorpej-signal, marc-pcmcia-bp, bouyer-scsipi
Branch point for: marc-pcmcia
Changes since 1.24: +2 -2 lines
Diff to previous 1.24 (colored) to selected 1.115 (colored)

Update for argument change in at_ifawithnet

Revision 1.24 / (download) - annotate - [select for diffs], Thu Apr 3 15:25:20 1997 UTC (27 years ago) by christos
Branch: MAIN
Changes since 1.23: +7 -1 lines
Diff to previous 1.23 (colored) to selected 1.115 (colored)

PR/3444: Erik Bertelsen: Eliminate warnings when -UINET

Revision 1.23 / (download) - annotate - [select for diffs], Wed Apr 2 21:23:26 1997 UTC (27 years ago) by christos
Branch: MAIN
Changes since 1.22: +101 -5 lines
Diff to previous 1.22 (colored) to selected 1.115 (colored)

Add netatalk stubs.

Revision 1.22 / (download) - annotate - [select for diffs], Sat Mar 15 18:12:26 1997 UTC (27 years, 1 month ago) by is
Branch: MAIN
Changes since 1.21: +69 -35 lines
Diff to previous 1.21 (colored) to selected 1.115 (colored)

New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.

Revision 1.21 / (download) - annotate - [select for diffs], Sun Oct 13 02:11:00 1996 UTC (27 years, 6 months ago) by christos
Branch: MAIN
CVS Tags: thorpej-setroot, mrg-vm-swap, is-newarp-before-merge, is-newarp-base
Branch point for: is-newarp
Changes since 1.20: +10 -10 lines
Diff to previous 1.20 (colored) to selected 1.115 (colored)

backout previous kprintf change

Revision 1.20 / (download) - annotate - [select for diffs], Thu Oct 10 22:59:45 1996 UTC (27 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.19: +10 -10 lines
Diff to previous 1.19 (colored) to selected 1.115 (colored)

- printf -> kprintf, sprintf -> ksprintf

Revision 1.19 / (download) - annotate - [select for diffs], Tue May 7 02:40:30 1996 UTC (27 years, 11 months ago) by thorpej
Branch: MAIN
CVS Tags: netbsd-1-2-base, netbsd-1-2-RELEASE, netbsd-1-2-PATCH001, netbsd-1-2-BETA, netbsd-1-2
Changes since 1.18: +2 -2 lines
Diff to previous 1.18 (colored) to selected 1.115 (colored)

Changed struct ifnet to have a pointer to the softc of the underlying
device and a printable "external name" (name + unit number), thus eliminating
if_name and if_unit.  Updated interface to (*if_watchdog)() and (*if_reset)()
to take a struct ifnet *, rather than a unit number.

Revision 1.18 / (download) - annotate - [select for diffs], Tue Feb 13 22:00:14 1996 UTC (28 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.17: +20 -14 lines
Diff to previous 1.17 (colored) to selected 1.115 (colored)

Net prototypes

Revision 1.17 / (download) - annotate - [select for diffs], Sun Dec 24 03:33:43 1995 UTC (28 years, 3 months ago) by mycroft
Branch: MAIN
Changes since 1.16: +8 -9 lines
Diff to previous 1.16 (colored) to selected 1.115 (colored)

Avoid extra byte-swapping in average cases.

Revision 1.16 / (download) - annotate - [select for diffs], Sun Dec 24 03:12:29 1995 UTC (28 years, 3 months ago) by mycroft
Branch: MAIN
Changes since 1.15: +2 -4 lines
Diff to previous 1.15 (colored) to selected 1.115 (colored)

Remove old comment regarding trailers.

Revision 1.15 / (download) - annotate - [select for diffs], Fri Sep 29 03:37:43 1995 UTC (28 years, 6 months ago) by phil
Branch: MAIN
CVS Tags: netbsd-1-1-base, netbsd-1-1-RELEASE, netbsd-1-1-PATCH001, netbsd-1-1
Changes since 1.14: +2 -2 lines
Diff to previous 1.14 (colored) to selected 1.115 (colored)

Move a #include to outside the #ifdef INET so it will compile without
INET defined.

Revision 1.14 / (download) - annotate - [select for diffs], Sat Aug 19 16:33:17 1995 UTC (28 years, 8 months ago) by mycroft
Branch: MAIN
Changes since 1.13: +2 -5 lines
Diff to previous 1.13 (colored) to selected 1.115 (colored)

Garbage collect useless `off' and `len' variables.

Revision 1.13 / (download) - annotate - [select for diffs], Mon Jun 12 00:46:52 1995 UTC (28 years, 10 months ago) by mycroft
Branch: MAIN
Changes since 1.12: +6 -9 lines
Diff to previous 1.12 (colored) to selected 1.115 (colored)

Various cleanup, including:
* Convert several data structures to use queue.h.
* Split in_pcbnotify() into two parts; one for notifying a specific PCB, and
one for notifying all PCBs for a particular foreign address.

Revision 1.12 / (download) - annotate - [select for diffs], Fri Apr 7 22:19:29 1995 UTC (29 years ago) by mycroft
Branch: MAIN
Changes since 1.11: +2 -2 lines
Diff to previous 1.11 (colored) to selected 1.115 (colored)

Set if_output in ether_ifattach().

Revision 1.11 / (download) - annotate - [select for diffs], Wed Apr 5 21:38:50 1995 UTC (29 years ago) by mycroft
Branch: MAIN
Changes since 1.10: +7 -7 lines
Diff to previous 1.10 (colored) to selected 1.115 (colored)

Make OSI and X.25 work on little-endian machines.

Revision 1.10 / (download) - annotate - [select for diffs], Wed Mar 8 02:56:55 1995 UTC (29 years, 1 month ago) by cgd
Branch: MAIN
Changes since 1.9: +3 -3 lines
Diff to previous 1.9 (colored) to selected 1.115 (colored)

fixed sized types, where appropriate.  when casting pointers to
integers to do math on them, cast to long.  ioctl commands are
u_longs.

Revision 1.9 / (download) - annotate - [select for diffs], Wed Jun 29 06:36:11 1994 UTC (29 years, 9 months ago) by cgd
Branch: MAIN
CVS Tags: netbsd-1-0-base, netbsd-1-0-RELEASE, netbsd-1-0-PATCH1, netbsd-1-0-PATCH06, netbsd-1-0-PATCH05, netbsd-1-0-PATCH04, netbsd-1-0-PATCH03, netbsd-1-0-PATCH02, netbsd-1-0-PATCH0, netbsd-1-0
Changes since 1.8: +2 -0 lines
Diff to previous 1.8 (colored) to selected 1.115 (colored)

New RCS ID's, take two.  they're more aesthecially pleasant, and use 'NetBSD'

Revision 1.8 / (download) - annotate - [select for diffs], Fri May 13 06:02:36 1994 UTC (29 years, 11 months ago) by mycroft
Branch: MAIN
Changes since 1.7: +244 -164 lines
Diff to previous 1.7 (colored) to selected 1.115 (colored)

Update to 4.4-Lite networking code, with a few local changes.

Revision 1.7 / (download) - annotate - [select for diffs], Mon Apr 18 06:18:10 1994 UTC (30 years ago) by glass
Branch: MAIN
Changes since 1.6: +5 -1 lines
Diff to previous 1.6 (colored) to selected 1.115 (colored)

revised nfs diskless support.  uses bootp+rpc to gather parameters

Revision 1.6 / (download) - annotate - [select for diffs], Wed Feb 2 01:21:36 1994 UTC (30 years, 2 months ago) by hpeyerl
Branch: MAIN
Changes since 1.5: +1 -15 lines
Diff to previous 1.5 (colored) to selected 1.115 (colored)

Multicast is no longer optional

Revision 1.5 / (download) - annotate - [select for diffs], Sun Jan 23 23:41:14 1994 UTC (30 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.4: +10 -7 lines
Diff to previous 1.4 (colored) to selected 1.115 (colored)

ether_output() & ether_input() take ether_type as a net-short.
AF_UNSPEC does not swap byte order of ether_type.
NOTE: this requires driver changes

Revision 1.4 / (download) - annotate - [select for diffs], Fri Dec 17 00:12:11 1993 UTC (30 years, 4 months ago) by mycroft
Branch: MAIN
Changes since 1.3: +28 -28 lines
Diff to previous 1.3 (colored) to selected 1.115 (colored)

From magnum branch:
Remove Jolitz's netisr kluge.  Make sure cpl == 0 really means base priority.
Other minor cleanup.

Revision 1.3 / (download) - annotate - [select for diffs], Mon Dec 6 04:50:19 1993 UTC (30 years, 4 months ago) by hpeyerl
Branch: MAIN
Changes since 1.2: +198 -5 lines
Diff to previous 1.2 (colored) to selected 1.115 (colored)

multicast support.
>From Chris Maeda, cmaeda@cs.washington.edu
These patches are derived from the IP Multicast patches for BSDI.

Revision 1.2 / (download) - annotate - [select for diffs], Thu May 20 03:05:59 1993 UTC (30 years, 11 months ago) by cgd
Branch: MAIN
CVS Tags: netbsd-0-9-patch-001, netbsd-0-9-base, netbsd-0-9-RELEASE, netbsd-0-9-BETA, netbsd-0-9-ALPHA2, netbsd-0-9-ALPHA, netbsd-0-9, magnum-base
Branch point for: magnum
Changes since 1.1: +2 -1 lines
Diff to previous 1.1 (colored) to selected 1.115 (colored)

add rcs ids to everything, and clean up headers

Revision 1.1 / (download) - annotate - [select for diffs], Sun Mar 21 09:45:37 1993 UTC (31 years, 1 month ago) by cgd
Branch: MAIN
Diff to selected 1.115 (colored)

Initial revision

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>